- 博客(10)
- 资源 (2)
- 收藏
- 关注
原创 python 格式化日期time
import timetime.strftime("%Y-%m-%d %H:%M:%S", time.localtime())Out[7]: '2021-03-31 02:48:51'time.strftime("%a %b %d %H:%M:%S %Y", time.localtime()) Out[9]: 'Wed Mar 31 02:50:41 2021'# 将格式字符串转换为时间戳a = 'Wed Mar 31 02:50:41 2021'time.mktime(time.strpt
2021-03-31 10:53:40 134
原创 python pandas入门(2)
#_*_ coding: utf-8 _*_import numpy as npimport pandas as pdimport matplotlib.pyplot as pltdf = pd.DataFrame({'A': ['foo', 'bar', 'foo', 'bar','foo', 'bar', 'foo', 'foo'], 'B': ['one', 'one', 'two', 'three','two', 'two', 'one', 'thre
2021-03-30 21:36:45 90
原创 ubuntu pip升级以后报错sys.stderr.write(f“ERROR: {exc}“)
apt-get remove --purge python-piprm -f /usr/local/bin/pipeasy_install pip==20.3.4ln -s /usr/local/bin/pip /usr/bin/pip
2021-03-23 09:59:57 1084 1
原创 python pandas入门(1)
#_*_ coding: utf-8 _*_import numpy as npimport pandas as pds= pd.Series([1,3,5,np.nan,6,8])dates = pd.date_range('20130101', periods=6)df = pd.DataFrame(np.random.randn(6, 4), index=dates, columns=list('ABCD'))#根据字典对象生成 DataFramedf2 = pd.DataFrame
2021-03-17 23:09:44 135
原创 python将pandas底层数据转numpy
主要使用to_numpy()df = pd.DataFrame(np.random.randn(6, 4), index=dates, columns=list('ABCD')) A B C D2013-01-01 -0.795050 -1.462931 -0.432862 -0.6215602013-01-02 0.831265 -1.166442 -0.783398 -0.6201672013-01-03
2021-03-16 22:49:23 1337
原创 python tkinter的简要应用
class Mygui(): def __init__(self): self.window = tk.Tk() screenwidth = self.window.winfo_screenwidth() screenheight = self.window.winfo_screenheight() x, y = int((screenwidth - 400) / 2), int((screenheight - 400) / 2)
2021-03-15 09:51:39 181
原创 pyinstaller打包folium相关项目
我的是在winx64位环境下,首先说一下pyinstaller打包项目的流程pythontaller -D xx.py 会生成xx.spec文件pyinstaller -w xx.spec参数意义:-F 打包单个文件,产生一个文件用于部署(默认),如果代码都写在一个.py文件时使用,项目有多个文件时不要使用-D 1.打包多个文件,产生一个目录用于部署(默认),用于框架编写的代码打包例:pyinstaller -D xxx.py(项目入口文件)例:pyinstaller --one
2021-03-15 09:12:48 409
原创 python list按第二个元素排序
主要用到key函数可以根据自己需求制定相应的key函数def takeSecond(elem): return int(elem)a = ['10000', '3000', '5000', '7000']a.sort(key = takeSecond)print(a)Out[13]: ['3000', '5000', '7000', '10000']
2021-03-13 19:40:08 1324
原创 python将字符串形式的列表转换成真实列表
主要用到json模块a ='[[45.5816,114.1634],[40.5816,104.1634],[39.5816,98.1634]]'import jsond = json.loads(a)d[0]Out[5]: [45.5816, 114.1634]
2021-03-12 16:50:40 182
原创 python opencv Kmeans聚类
使用Kmeans将图片颜色聚类import cv2import numpy as npimport matplotlib.pyplot as pltImg= cv2.imread('sunshine.jpg')img = cv2.cvtColor(Img,cv2.COLOR_BGR2RGB)Z = img.reshape((-1,3))z = np.float32(Z)criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITE
2021-03-01 23:03:37 248
kubernetes.tar.gz
2020-02-16
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人