特殊项处理——计算最小距离时如何排除自身
2016-01-27 14:32
435 查看
在计算除自身外距离最近的位置时,通过将计算自身时的距离设置为极大值(以能达到目的为准)以规避。这样计算最小距离就会排除自身:
极大值也不能设置过大,否则会有提示:
UserWarning: Discarded range with reserved name
warnings.warn("Discarded range with reserved name")
原因如下:点击打开链接
It's supposed to be a friendly warning letting you know that some of the defined names are being lost when reading the file. Warnings in Python are not exceptions but informational notices.
Support for defined names is essentially limited to references to cell ranges in openpyxl at the moment. But they can refer to lots of other things like printing settings. However, if the objects/values they refer to are not preserved by
openpyxl and the file is saved and later opened by Excel it might complain about the missing objects.
for i in range(2,ws1.get_highest_row()+1): distance=[] lng1=ws1['B'+str(i)].value lat1=ws1['C'+str(i)].value #lat1=float(lat1) for j in range(2,ws1.get_highest_row()+1): if j==i: #计算与自身的距离时,将结果设置为一个极大值, #这样计算最小距离时就会排除自身 distance.append(100000000) continue
极大值也不能设置过大,否则会有提示:
UserWarning: Discarded range with reserved name
warnings.warn("Discarded range with reserved name")
原因如下:点击打开链接
It's supposed to be a friendly warning letting you know that some of the defined names are being lost when reading the file. Warnings in Python are not exceptions but informational notices.
Support for defined names is essentially limited to references to cell ranges in openpyxl at the moment. But they can refer to lots of other things like printing settings. However, if the objects/values they refer to are not preserved by
openpyxl and the file is saved and later opened by Excel it might complain about the missing objects.
相关文章推荐
- 解决:警告:com.sun.image.codec.jpeg.JPEGImageEncoder 是 Sun 的专用 API,可能会在未来版本中删除
- 常用时区TimeZone转化代码
- 解决:java.lang.IllegalArgumentException: Illegal group reference
- 深度探索Linux内存模型
- Java求交集和并集
- 解决:Could not parse response code.Server Reply: SSH-2.0-OpenSSH_5.3
- 如何用vncviewer和virt-manager管理和创建虚拟机
- SPOJ - PGCD Primes in GCD Table - 莫比乌斯反演
- oracle中,创建其他用户表的对应视图
- iOS 开发 入门:发布应用到App Store 详细教程
- Mysql数据库优化---2.慢查询(一)
- 网络传输数据如何加密
- margin负值的相关应用
- HackerRank "Bike Racer"
- 解决:java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException
- 解决:雷柏X1800无线键鼠鼠标键失灵单双键错乱
- 关于c语言结构体内存对齐有感
- 如何在web中实现多文件上传
- discuz 数据库密码修改后 管理后台不能登录问题
- Java基础-数据类型