使用到的模块有pyecharts,pandas,selenium,time,Interval,re,requests,random
(以后会在这个系统逐渐记录解决问题所遇到的模块详细的学习过程)

# 所有数据的可视化
# 加载pyecharts
from pyecharts import Geo, Style
import pandas as pd# 导入excel表
df = pd.read_excel('处理1.xlsx')
df.head()
# 导入自定义的地点经纬度
geo_cities_coords = {df.iloc[i]['任务号码']: [df.iloc[i]['任务gps经度'], df.iloc[i]['任务gps 纬度']]for i in range(len(df))}
attr = list(df['任务号码'])
value = list(df['任务标价'])
style = Style(title_color="#fff", title_pos="center",width=1200, height=600, background_color="#404a59")# 可视化
geo = Geo('所有数据情况图', **style.init_style)
geo.add("", attr, value, visual_range=[65, 85], symbol_size=5,visual_text_color="#fff", is_piecewise=True,is_visualmap=True, maptype='广东', visual_split_number=10,geo_cities_coords=geo_cities_coords,pieces=[{'max':85,'min':83.5,'label':'83.5-85'},{'max':83,'min':81.5,'label':'81.5-83'},{'max':81,'min':79.5,'label':'79.5-81'},{'max':79,'min':77.5,'label':'77.5-79'},{'max':77,'min':75.5,'label':'75.5-77'},{'max':75.5,'min':73.5,'label':'73.5-75'},{'max':73,'min':71.5,'label':'71.5-73'},{'max':71,'min':69.5,'label':'69.5-71'},{'max':69,'min':67.5,'label':'67.5-69'},{'max':67,'min':65,'label':'65-67'}])
geo.render('所有数据可视化.html')
# 完成点的数据可视化
# 加载pyecharts
from pyecharts import Geo, Style
import pandas as pd# 导入excel表
df = pd.read_excel('test1.xlsx')
df.head()
# 导入自定义的地点经纬度
geo_cities_coords = {df.iloc[i]['任务号码']: [df.iloc[i]['任务gps经度'], df.iloc[i]['任务gps 纬度']]for i in range(len(df))}
attr = list(df['任务号码'])
value = list(df['任务标价'])
style = Style(title_color="#fff", title_pos="center",width=1200, height=600, background_color="#404a59")# 可视化
geo = Geo('完成数据情况图', **style.init_style)
geo.add("", attr, value, visual_range=[65, 85], symbol_size=5,visual_text_color="#fff", is_piecewise=True,is_visualmap=True, maptype='广东', visual_split_number=10,geo_cities_coords=geo_cities_coords,pieces=[{'max':85,'min':83.5,'label':'83.5-85'},{'max':83,'min':81.5,'label':'81.5-83'},{'max':81,'min':79.5,'label':'79.5-81'},{'max':79,'min':77.5,'label':'77.5-79'},{'max':77,'min':75.5,'label':'75.5-77'},{'max':75.5,'min':73.5,'label':'73.5-75'},{'max':73,'min':71.5,'label':'71.5-73'},{'max':71,'min':69.5,'label':'69.5-71'},{'max':69,'min':67.5,'label':'67.5-69'},{'max':67,'min':65,'label':'65-67'}])
geo.render('完成数据可视化.html')
# 未完成数据的可视化
# 加载pyecharts
from pyecharts import Geo, Style
import pandas as pd# 导入excel表
df = pd.read_excel('test0.xlsx')
df.head()
# 导入自定义的地点经纬度
geo_cities_coords = {df.iloc[i]['任务号码']: [df.iloc[i]['任务gps经度'], df.iloc[i]['任务gps 纬度']]for i in range(len(df))}
attr = list(df['任务号码'])
value = list(df['任务标价'])
style = Style(title_color="#fff", title_pos="center",width=1200, height=600, background_color="#404a59")# 可视化
geo = Geo('未完成数据情况图', **style.init_style)
geo.add("", attr, value, visual_range=[65, 85], symbol_size=5,visual_text_color="#fff", is_piecewise=True,is_visualmap=True, maptype='广东', visual_split_number=10,geo_cities_coords=geo_cities_coords,pieces=[{'max':85,'min':83.5,'label':'83.5-85'},{'max':83,'min':81.5,'label':'81.5-83'},{'max':81,'min':79.5,'label':'79.5-81'},{'max':79,'min':77.5,'label':'77.5-79'},{'max':77,'min':75.5,'label':'75.5-77'},{'max':75.5,'min':73.5,'label':'73.5-75'},{'max':73,'min':71.5,'label':'71.5-73'},{'max':71,'min':69.5,'label':'69.5-71'},{'max':69,'min':67.5,'label':'67.5-69'},{'max':67,'min':65,'label':'65-67'}])
geo.render('未完成可视化.html')
# 利用经纬度进行位置判断
from selenium import webdriver
import pandas as pd
import timedf = pd.read_excel('处理1.xlsx',converters={'任务号码':str,'任务gps 纬度':str,'任务gps经度':str})
df.head()
# print(df)
key = df['任务gps经度'] + ',' + df['任务gps 纬度']
# print(type(key))
num = df['任务号码']
filmlist = []
flag = 0for i in key:#print(i)url = 'https://www.bejson.com/convert/map/'driver = webdriver.Chrome()driver.get(url)driver.find_element_by_xpath('//*[@id="primaryradio2"]').click()driver.find_element_by_xpath('//*[@id="txtSearch"]').send_keys(i)driver.find_element_by_xpath('//*[@id="myPageTop"]/div[1]/div[2]/span/a').click()time.sleep(1)area = driver.find_element_by_xpath('//*[@id="btnCurrentCity"]/span').get_attribute('innerHTML')time.sleep(0.5)flag += 1dic = {}dic['定位地区'] = areadic['任务号码'] = num[list(key).index(i)]# print(num[list(key).index(i)])print(area)filmlist.append(dic)driver.quit()# 有问题
# with open(r'D:\pycharm\PycharmProjects\pic/'+'成功率.csv','w',encoding='utf-8',newline='') as dic_f:
#     # 创建表头
#     writer = csv.DictWriter(dic_f,fieldnames=['任务号码','定位地区'])
#     # 写入表头
#     writer.writeheader()
#     for i in filmlist:
#         writer.writerow(i)
# 基于任务点的会员密集程度(简单版)
import pandas as pd
from interval import Intervaldf1 = pd.read_excel('会员经纬度.xlsx',converters={'v经度':float,'v纬度':float})
df1.head()
# print(df)df2 = pd.read_excel('任务范围.xlsx',converters={'max经度':float,'max纬度':float,'min经度':float,'min纬度':float})
df2.head()
# print(df2)k = 1
for i in df2['max经度']:for j in df1['v经度']:# print(list(df2['max经度']).index(i))# print(list(df1['v经度'])[list(df2['max经度']).index(i)])p = 0vj = j# print(vj)vw = list(df1['v纬度'])[list(df1['v经度']).index(j)]# print(vw)maxj = i# print(maxj)minj = list(df2['min经度'])[list(df2['max经度']).index(i)]# print(minj)maxw = list(df2['max纬度'])[list(df2['max经度']).index(i)]# print(maxw)minw = list(df2['min纬度'])[list(df2['max经度']).index(i)]# print(minw)print('--------')# 有问题if vj in Interval(minj,maxj) and vw in Interval(minw,maxw):p += 1else:k += 1print(p)
# 基于任务点的会员密集程度(复杂版)
import pandas as pd
import re
import requests
import randomdf = pd.read_excel('中心点经纬度及会员经纬度.xlsx',converters={'c经度':str,'c纬度':str,'v经度':str,'v纬度':str})
df.head()
# print(df)r = 216.3
key1 = df['c经度'] + '%2C' + df['c纬度']
key2 = df['v经度'] + '%2C' + df['v纬度']# print(key1)
# print(key2)
p = 1
for k in key1:for i in key2:try:base_url = 'http://boulter.com/gps/distance/'# http://boulter.com/gps/distance/?from=114.001053133118%2C22.9915954333008&to=113.679983%2C22.947097&units=m# http://boulter.com/gps/distance/?from=114.001053133118%2C22.9915954333008&to=106.239083%2C29.560903&units=murl = base_url + '?from=' + k + '&to=' + i + '&units=m'# print(url)j = 0if url != []:# print(url)headers_choice = [{'User-Agent': 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50safari 5.1 – Windows'},{'User-Agent': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon 2.0)TT'}, {'User-Agent': '?Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SE 2.X MetaSr 1.0; SE 2.X MetaSr 1.0; .NET CLR 2.0.50727; SE 2.X MetaSr 1.0)'},{'User-Agent': 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5'},{'User-Agent': 'MQQBrowser/26 Mozilla/5.0 (Linux; U; Android 2.3.7; zh-cn; MB200 Build/GRJ22; CyanogenMod-7) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'},{'User-Agent': 'Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; HTC; Titan)'},{'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11'},{'User-Agent': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)Firefox 4.0.1 – MAC'}]headers = random.choice(headers_choice)# 奇葩网站,不能设置代理ip,一设置便获得不了信息response = requests.get(url,headers=headers)# print(response)response.encoding = response.apparent_encodinghtml = response.text# print(html)d = re.findall(r'</TD><TD>(.*?) miles \w*? .*?\n<INPUT TYPE=HIDDEN VALUE="Waypoint 01" NAME=name0>',html)[0]# print(d)# print('完成了一次')if float(d) < r:j += 1else:continueexcept:continueprint(f'第{p}个点的密集度为{j}')p += 1print('---------------------')

解决cumcm17问题的代码记录(待改正)相关推荐

  1. php fpm 日志记录,如何解决nginx下php-fpm不记录php报错日志的问题

    如何解决nginx下php-fpm不记录php报错日志的问题 发布时间:2020-07-28 10:17:29 来源:亿速云 阅读:150 作者:Leah 本篇文章为大家展示了如何解决nginx下ph ...

  2. c语言让系统蓝屏,0x000000116,教您解决电脑蓝屏代码0x000000116

    我们知道电脑使用不当会导致蓝屏甚至无法启动,而原因有很多,像常见的硬件之间不兼容,软件之间不兼容等,针对不同原因导致的电脑蓝屏,解决方法有所差别.而蓝屏代码0x000000116有是什么情况,该怎么解 ...

  3. 【我的笔记】VScode遇到的小问题以及个人配置代码记录

    笔记 记录bug,arduino选不了板 个人配置代码记录 环境搭建及编译时中文乱码问题 下载页面的使用说明 库的配置 记录bug,arduino选不了板 开发arduino我用VScode,但是最近 ...

  4. 微服务并不能解决你的烂代码问题

    " 微服务并不能解决你的烂代码问题 很久以来,软件的交付质量一直是一个大家比较关心的问题,而程序员和架构师也一直在极力寻找一种更好的方式来构建应用系统.随着互联网爆炸式的增长,对于系统的交付 ...

  5. python怎么重启内核_解决jupyter运行pyqt代码内核重启的问题

    在jupyter notebook或者是 Qtconsole下编译运行一个简单的pyqt程序,总是报错: The kernel appears to have died. It will restar ...

  6. uiautomator 代码记录 :BT接收测试

    uiautomator 代码记录 :BT接收测试 package rom;import java.lang.*; import java.util.Random; import java.io.Fil ...

  7. [解决]CXF wsdl2java 生成代码存在的一些问题

    [解决]CXF wsdl2java 生成代码存在的一些问题 参考文章: (1)[解决]CXF wsdl2java 生成代码存在的一些问题 (2)https://www.cnblogs.com/boaz ...

  8. 自定义起始时间的时间戳计算(个人代码记录)

    个人代码记录,这个时间戳计算,由于项目数据特殊需求,自己设置的时间戳起始时间为2019年1月1日开始, 然后根据时间戳数据计算出现在时间,具体使用如下,这里setFullYear的月份是0到11,所以 ...

  9. 今日代码(20210313)--美赛代码记录

    代码记录 第1及第6题(PageRank+Lasso) my_pagerank <- function(M, r, n, b) {N <- dim(M)[2]r <- r/sum(a ...

最新文章

  1. java培训班如何选择
  2. 常用巡检语句(oracle)
  3. 一个递归函数的漏洞及优化
  4. 【78.89%】【codeforces 746A】Compote
  5. c++STL容器的List
  6. VirtualBox压缩vmdk、vagrant打包box一口气全对
  7. 从SAP Leonardo到SAP Data Intelligence
  8. json/ 发送形式_24/7的完整形式是什么?
  9. Python | 使用matplotlib.pyplot创建线图
  10. LeetCode 70 爬楼梯
  11. C语言带参数的main()函数
  12. 求水面面积(C语言)
  13. Python 利用*args和**kwargs解决函数遇到不确定数量参数问题
  14. matlab2c使用c++实现matlab函数系列教程-sort函数
  15. 仓库出租平台有哪些_日用品仓库出租哪家划算周到
  16. windows电脑 安装asreml 设置防火墙 network TCP ports 5053 5443
  17. 读《大数据时代:生活,工作与思维的大变革》
  18. 《小话投行》转自2011 Morgan Stanley HK IBD唯一的大陆本科生
  19. Ubuntu18.04 搜狗输入法安装(史上最好用的输入法安装方法)
  20. 语音数据集 | Speech datasets

热门文章

  1. solrcloud入门详细使用教程
  2. 完整且详细的单链表代码
  3. Linux:系统安全及应用
  4. 关闭selinux的方法汇总
  5. oracle AWR 报告 中文版
  6. python的or的用法_python中or和and的用法
  7. 云服务 IaaS、PaaS、SaaS
  8. 【Linux-MYSQL】数据库的使用
  9. 破解明星网红带货易翻车的方法——企业直播
  10. 自动部署项目,全靠它了!