当前位置:网站首页>Research Summary / programming FAQs
Research Summary / programming FAQs
2022-07-24 14:20:00 【Strong fight】
1. utilize Python Calculate the actual distance between the two places through longitude and latitude
The formula :D = arccos((sin North latitude A×sin North latitude B)+(cos North latitude A×cos North latitude B×cosAB Longitude difference between the two places ))× The average radius of the earth (Shormin) The average radius of the earth is 6371.004 km,D The unit is km
① The formula calculates the distance between two points (m)
from math import radians, cos, sin, asin, sqrt
def geodistance(lng1,lat1,lng2,lat2):
#lng1,lat1,lng2,lat2 = (120.12,30.28,115.86,28.74)
lng1, lat1, lng2, lat2 = map(radians, [float(lng1), float(lat1), float(lng2), float(lat2)]) # Conversion of longitude and latitude to radian
dlon=lng2-lng1
dlat=lat2-lat1
a=sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
distance=2*asin(sqrt(a))*6371*1000 # The average radius of the earth ,6371km
distance=round(distance/1000,3)
return distance
② call geopy package
from geopy.distance import geodesic
print(geodesic((30.28,120.12), (28.74,115.86)).m) # Calculate the distance between two coordinate lines
print(geodesic((30.28,120.12), (28.74,115.86)).km)
cmd Install under window tensorflow Solve the problem of long response time
pip install tensorflow -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
Installed under the system compiler
Programming bug:
①AttributeError: ‘NoneType’ object has no attribute ‘val’
Generally, the tree structure does not judge whether it exists .
② If a string composed of non pure numbers is forcibly converted to an integer, an error will be reported :
ValueError: invalid literal for int() with base 10
③AttributeError: module ‘pandas’ has no attribute ‘Series’( And similar situations )
It may be due to the following reasons :
(1) package Failed to install successfully or update to the latest version ;
(2) There is a problem with your file name , For example, in the above case, name the file pandas.py.
Or your other files are named pandas Of .( Own mistakes )
④pycharm Printing big data files is incomplete :
solve : Add this line of code :
pd.set_option('display.max_columns', None)
problem 1. describe : No Internet connection , Open the app as initialization failure:0X0000000c :
resolvent :① Open the console as an administrator .
② Input “NETSH WINSOCK RESET CATALOG”.
③ enter , Tips Reset winsock Catalog success . Restart the computer to complete the configuration .
problem 2: Computer Icon disappear
resolvent : Personalization - > The theme -> Desktop icon settings
边栏推荐
- C# 多线程锁整理记录
- Mini examination - examination system
- SQL subquery
- JS judge whether the data is empty
- Rasa 3.x learning series -rasa fallbackclassifier source code learning notes
- The spiral matrix of the force buckle rotates together (you can understand it)
- Error importing header file to PCH
- 【机器学习】之 主成分分析PCA
- Simple understanding and implementation of unity delegate
- Detailed analysis of common command modules of ansible service
猜你喜欢

2022 IAA industry category development insight series report - phase II

Not configured in app.json (uni releases wechat applet)

mysql

Typo in static class property declarationeslint

北京一卡通以35288.8529万元挂牌出让68.45%股权,溢价率为84%

电赛设计报告模板及历年资源

Centos7 installs Damon stand-alone database

【C语言笔记分享】——动态内存管理malloc、free、calloc、realloc、柔性数组

bibliometrix: 从千万篇论文中挖掘出最值得读的那一篇!

小熊派 课程导读
随机推荐
Rasa 3.x learning series -rasa fallbackclassifier source code learning notes
Cocoapod installation problems
The fourth edition of Zhejiang University probability proves that the uncorrelation of normal distribution random variables is equivalent to independence
Rasa 3.x learning series -rasa [3.2.4] - 2022-07-21 new release
Beijing all in one card listed and sold 68.45% of its equity at 352.888529 million yuan, with a premium rate of 84%
Solve the problem that the ARR containsobject method returns no every time
Remove the treasure box app with the green logo that cannot be deleted from iPhone
Mini examination - examination system
Not configured in app.json (uni releases wechat applet)
Don't lose heart. The famous research on the explosive influence of Yolo and PageRank has been rejected by the CS summit
String - 459. Repeated substrings
mysql
电赛设计报告模板及
[oauth2] II. Authorization method of oauth2
Video game design report template and
Regular expression and bypass cases
Stack and queue - 225. Implement stack with queue
SQL Server syntax - create database
AtCoder Beginner Contest 261 F // 树状数组
Solve the problem that uni starter can log in to wechat with local functions, but fails to log in with cloud functions