- 博客(20)
- 资源 (7)
- 收藏
- 关注
原创 根据Geohash编码画中心点和边框
#得到司机的Geohash后返回前六位Geohash的图像from pygeohash import encode, decodeimport plotlyimport plotly.plotly as pyfimport plotly.graph_objs as goimport numpy as npimport pandas as pdimport mathfrom mat...
2020-01-18 14:13:08 1380
原创 测试_根据位置经纬度返回最近的Geohash
# 现在要做:# 2:取Geohash的前N位# 3:计算前位Geohash的demand#4 返回离司机最近的最有可能接单的Geohash位置和demandfrom pygeohash import encode, decodeimport plotlyimport plotly.plotly as pyfimport plotly.graph_objs as goimport...
2020-01-17 15:51:45 389
原创 控制台输入Geohash的位数得到对应Geohash的订单量和占比
MySQL语句包含嵌套查询# 现在要做:# 2:取Geohash的前N位# 3:计算前位Geohash的demand# 4:根据出租车的位置经纬度返回最近的Geohashfrom pygeohash import encode, decodeimport plotlyimport plotly.plotly as pyfimport plotly.graph_objs as go...
2020-01-17 10:51:17 268
原创 取Geohash的前N位
def top_geohash(geohash1,n): new_total = [] # 根据total 得到的前4位全部的编码 block_dict = {} central_dict = {} for i in geohash1: new_total.append(i[:n]) # 取前n个geohash return new_to...
2020-01-17 08:51:50 329
原创 MySQL里的经纬度转为Geohash后插回数据库
MySQL里的经纬度转为Geohash后插回数据库from pygeohash import encode, decodeimport plotlyimport plotly.plotly as pyfimport plotly.graph_objs as goimport numpy as npimport pandas as pdimport mathfrom matplotl...
2020-01-16 21:30:30 1072
原创 MySQL分组后统计
MySQL分组后统计select count(*) as number ,BeginLongitude , BeginLatitude FROM Order_Data where FROM_UNIXTIME(BeginTime) <'2016-11-01 00:05:00' GROUP BY BeginLongitude, BeginLatitude
2020-01-16 17:52:27 1214
原创 把经纬度转换为Geohash(准确)
# 现在要做:# 1:把数据库的经纬度读出生成Geohash# 2:取Geohash的前N位# 3:计算前N未Geohash的demandfrom pygeohash import encode, decodeimport plotlyimport plotly.plotly as pyfimport plotly.graph_objs as goimport numpy as ...
2020-01-16 17:24:25 4879
原创 根据经纬度生成Geohash
#---zhangpengxu---#-*- coding: utf-8 -*-from pygeohash import encode, decodeimport plotlyimport plotly.plotly as pyfimport plotly.graph_objs as goimport numpy as npimport pandas as pdimport m...
2020-01-16 15:02:24 1713
原创 Python读取MySQL数据生成热力图
port numpy as npimport pandas as pdimport foliumimport webbrowserfrom folium.plugins import HeatMapimport datetimeimport timeimport pymysql.cursorsimport decimal# 创建一个游标conn = pymysql.connec...
2020-01-14 20:05:38 698
原创 Python用plotly画图
import plotly.offline as ofimport plotly.graph_objs as goof.offline.init_notebook_mode(connected=True)trace0 = go.Scatter( x=[1, 2, 3, 4], y=[10, 15, 13, 17], mode='markers')trace1 =...
2020-01-14 15:46:54 389
原创 python读取数据写入MySQL数据库
#—zhangpengxu—#-- coding: utf-8 --import datetimeimport timeimport pymysql.cursorsimport decimal创建一个游标conn = pymysql.connect(host=‘localhost’,port=3306,user=‘root’,passwd=‘xu19931026’,db=‘...
2020-01-14 11:16:46 1072
原创 机器学习测试002
sort_values函数import datetimeimport pandas as pddf = pd.DataFrame({'col1' : ['A', 'A', 'B', 'F', 'D', 'C'],'col2' : [2, 1, 9, 8, 7, 4],'col3': [0, 1, 9, 4, 2, 3],})print(df)输出:| col1 col2 col3...
2020-01-09 09:13:45 344
原创 Python网络爬虫学习
获取一个网页内容的标准方法:import requestsdef zpx(url): try: r=requests.get(url,timeout=30) r.raise_for_status() //如果状态不是200引发异常 r.encoding=r.apparent_encoding return r.text excep...
2020-01-09 09:08:19 253
原创 Python实现Excel生成汇总直方图
# -*- coding: utf-8 -*-import geohash as geohashimport xlwt # 写入excel文件的库import xlrd #读取Excelimport timeimport datetimeimport geohash #把经纬度转换为geohashimport randomstart_time=datetime.datet...
2020-01-08 12:10:35 2237
原创 把一个Excel中的经纬度转换为geohash写入另一个Excel
# -*- coding: utf-8 -*-import geohash as geohashimport xlwt # 写入excel文件的库import xlrd #读取Excelimport timeimport datetimeimport geohash #把经纬度转换为geohashstart_time=datetime.datetime.now()han...
2020-01-08 09:43:23 801 2
原创 matplotlib.pyplot画图
import matplotlib.pyplot as pltimport pandas as pdimport numpy as npfig,axes = plt.subplots(2,2,figsize=(15,5))s = pd.Series(np.random.randint(0,10,15),index = list('abcdefghijklmno'))#series是一个一...
2020-01-07 15:30:56 504
原创 Python多线程与多进程
多线程:def run(name): print(name, "线程执行了") time.sleep(10)# 程序执行时,程序本身就是一个线程,叫主线程# 手动创建的线程,叫子线程# 主线程的执行中不会等待子线程执行完毕,就会直接执行后面的代码# 创建线程t1 = threading.Thread(target=run, args=("t1",))t2 = th...
2020-01-03 08:34:09 183
原创 Python爬取豆瓣短评
豆瓣短评.pyfrom multiprocessing import Process #多进程import threading #多线程from lxml import etreeimport requestsimport timeimport randomimport ciyun as cy# //*[@id="comments"]/div[1]/div[2]/h3/s...
2020-01-03 08:32:14 1732
原创 简单的机器学习
# Regressor example# Code: https://github.com/keloli/KerasPractise/edit/master/Regressor.pyimport numpy as np #NumPy 通常与 SciPy(Scientific Python)和 Matplotlib(绘图库)一起使用, 这种组合广泛用于替代 MatLabnp.random....
2020-01-02 16:03:08 276
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人