随笔分类 -  python

摘要:https://numpy.org/doc/stable/user/quickstart.html 阅读全文
posted @ 2021-07-26 16:00 机器狗mo 阅读(21) 评论(0) 推荐(0)
摘要:#!/usr/bin/env python3 # -*- coding: utf-8 -*- import math import osmium as o import networkx as nx import geoleaflet import geojson RE = 6378137.0 # 阅读全文
posted @ 2021-07-19 16:55 机器狗mo 阅读(306) 评论(0) 推荐(0)
摘要:def point_on_line_seg(a, b, p): ap = p - a ab = b - a t = np.dot(ap, ab) / np.dot(ab, ab) # if you need the the closest point belonging to the segment 阅读全文
posted @ 2021-07-14 15:32 机器狗mo 阅读(426) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-07-10 18:09 机器狗mo 阅读(42) 评论(0) 推荐(0)
摘要:处理OpenStreetMap geo数据的工具包 阅读全文
posted @ 2021-07-09 10:05 机器狗mo 阅读(505) 评论(0) 推荐(0)
摘要:coord-convert https://pypi.org/project/coord-convert/ 阅读全文
posted @ 2021-06-16 12:43 机器狗mo 阅读(69) 评论(0) 推荐(0)
摘要:堆的定义: 1、完全二叉树 2、父节点的值大于等于字节的的值(大顶堆) # heapify功能:递归完成当前节点以及当前的节点的子节点堆的调整(父节点大于子节点) def heapify(arr, n, i): largest = i l = 2 * i + 1 # left = 2*i + 1 r 阅读全文
posted @ 2021-02-24 18:56 机器狗mo 阅读(103) 评论(0) 推荐(0)
摘要:Python 绘制图表 import matplotlib.pyplot as plt import numpy as np Matplotlib模块 X=np.linspace(start = -np.pi, stop=np.pi, num=256, endpoint=True) C,S = np 阅读全文
posted @ 2021-01-19 20:46 机器狗mo 阅读(888) 评论(0) 推荐(0)
摘要:转自博客:https://blog.csdn.net/qq_35318838/article/details/80564938 Python版本:Python 3.6 pandas.read_csv() 报错 OSError: Initializing from file failed,一般由两种情 阅读全文
posted @ 2020-11-17 10:32 机器狗mo 阅读(361) 评论(0) 推荐(0)
摘要:def haversine(lat1, lon1, lat2, lon2): # 经度1,纬度1,经度2,纬度2 (十进制度数) """ Calculate the great circle distance between two points on the earth (specified in 阅读全文
posted @ 2020-06-04 18:24 机器狗mo 阅读(129) 评论(0) 推荐(0)
摘要:##检查数据为空(nan) import math x=float('nan') math.isnan(x) ## 检查 def typeof(variate): type=None if isinstance(variate,int): type = "int" elif isinstance(v 阅读全文
posted @ 2019-12-16 13:32 机器狗mo 阅读(94) 评论(0) 推荐(0)
摘要:平常会经常用到多进程,可以用进程池pool来进行自动控制进程,下面介绍一下pool的简单使用。 需要注意的是,在Windows上要想使用进程模块,就必须把有关进程的代码写if name == ‘main’ :语句的下面,才能正常使用Windows下的进程模块。Unix/Linux下则不需要。 Poo 阅读全文
posted @ 2019-12-06 12:12 机器狗mo 阅读(409) 评论(0) 推荐(0)
摘要:Set your merge columns as index, and use df1.join(df2) instead https://stackoverflow.com/questions/40860457/improve-pandas-merge-performance 阅读全文
posted @ 2019-12-02 15:24 机器狗mo 阅读(1031) 评论(0) 推荐(0)
摘要:python package : https://github.com/mwburke/xgboost python deploy pred1 pred2 diff 33243 0.515672 0.515672 1.635301e 08 15742 0.478694 0.478694 3.4686 阅读全文
posted @ 2019-10-14 17:15 机器狗mo 阅读(941) 评论(0) 推荐(0)
摘要:.dataframe tbody tr th:only of type { vertical align: middle; } .dataframe tbody tr th { vertical align: top; } .dataframe thead th { text align: righ 阅读全文
posted @ 2019-02-11 16:58 机器狗mo 阅读(169) 评论(0) 推荐(0)
摘要:import pandas as pd import numpy as np ## 从字典初始化df ipl_data = {'Team': ['Riders', 'Riders', 'Devils', 'Devils', 'Kings', 'Kings', 'Kings', 'Kings', 'R 阅读全文
posted @ 2018-11-08 15:07 机器狗mo 阅读(424) 评论(0) 推荐(0)
摘要:很多时候需要从配置文件中读取参数,在程序中使用,这时候就需要用到ConfigParser模块(在Python3以上的版本中为configparser模块) 首先新建一个配置文件样例:myapp.conf 在Python代码中: 如果配置文件中有中文等字符,可以使用codecs读取文件 DEFAULT 阅读全文
posted @ 2018-10-09 17:12 机器狗mo 阅读(241) 评论(0) 推荐(0)
摘要:![](https://img2018.cnblogs.com/blog/724315/201809/724315-20180921223109361-1426293188.jpg) 阅读全文
posted @ 2018-09-21 21:15 机器狗mo 阅读(450) 评论(0) 推荐(0)
摘要:Python2: Unicode是一种通用的编码方式,不论是英文字母、汉字、日语还是其他文字都能够对应一个唯一的Unicode编码(序号)。 python3: 阅读全文
posted @ 2018-09-20 21:34 机器狗mo 阅读(1490) 评论(0) 推荐(0)
摘要:参考: "spark的介绍和pyspark的使用" 阅读全文
posted @ 2018-09-07 20:23 机器狗mo 阅读(1211) 评论(0) 推荐(0)