自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(175)
  • 资源 (7)
  • 收藏
  • 关注

原创 为OSM地图建立网络拓扑关系,导出shp文件

为OSM地图建立网络拓扑关系,导出shp文件

2023-03-02 19:23:06 845 1

原创 解决时序数据pandas groupby 按时间分组后0值填充的问题

针对时序数据按不同时间粒度统计时,如果粒度比较小比如15min会存在统计值为0,而pandas返回的dataframe默认只显示结果为非0的记录,如果此时需要填充,可以使用.unstack(fill_value=0).stack()

2023-03-02 11:02:22 518

原创 pandas groupby agg lambda分组多列筛选统计数量

pandas groupby agg lambda分组多列筛选统计数量

2023-02-23 08:59:51 1078

原创 解决mathtype公式和文字高度不对齐的问题

解决在word中插入mathtype公式后不对齐、高度不一致的问题

2022-10-14 13:53:50 30638 13

原创 pandas groupby agg多列重命名

使用pandas groupby对多列进行计算后自动重命名。

2022-09-14 19:16:58 2301

原创 Proxy_Pool 代理池与Redis配置的常见问题

问题1:ERROR redis connection error: Error 10061 connecting to 127.0.0.1:6379. 由于目标计算机积极拒绝,无法连接。解决:下载并安装Redis-x64-3.0.504.msi或zip都行,地址:https://github.com/MicrosoftArchive/redis/releases问题2:redis中redis.exceptions.AuthenticationError: Authentication require

2022-04-19 22:09:20 1012

原创 jupyterlab 插件安装

conda install -c conda-forge jupyterlab-variableinspectorconda install -c conda-forge jupyterlab_execute_timeNote: for this to show anything, you need to enable cell timing in the notebook via Settings->Advanced Settings Editor->Notebook: {"rec

2021-11-17 09:49:31 860

原创 geopandas 离线安装

Python Extension Packages for Windows - Christoph Gohlke (uci.edu)在这个网站下载以下whl文件,然后用pipinstall命令依次安装whl文件gdal fiona shapely pyproj geopandas

2021-10-06 10:59:18 469 1

原创 spyder删除默认变量

删除spyder变量浏览器(Variable Explore)中的默认变量,例如pi, e, euler_gamma, cast, ScalarType等Tools > Preferences > IPython console > Graphics > Automatically load Pylab and NumPy modules

2021-09-23 20:48:47 417

原创 jupyterlab插件

jupyterlab-spreadsheet  jupyterlab-spreadsheet帮助我们在jupyter lab中查看表格类文件,特别是其支持查看多工作表的excel表格文件jupyterlab-system-monitor  jupyterlab-system-monitor通过在jupyter lab界面中添加资源监视器部件,能帮助我们在工作过程中方便的看到CPU、内存的实时占用情况jupyterlab-kite  这个插件我们之前的文章仔细介绍过,帮助我们建立代码补..

2021-09-16 19:54:25 573

原创 pandas中文时间格式转换

31-3月 -18 11.24.01.000000000 上午格式转为标准时间格式首先使用apply函数将“上午”、“下午”替换:(lambda x:str(x).replace('.000000000 上午',' AM'))然后使用pd.to_datetime函数转化为时间格式 (data['col'], format="%d-%m月 -%y %I.%M.%S %p")format参考https://www.dataindeendent.com/pandas/pandas-to-...

2021-08-16 19:22:00 1172

原创 pandas按半小时区间分组统计

data.groupby(['col',data.START_HOUR.dt.floor('30Min')]).size().reset_index()

2021-08-16 19:14:34 1235

原创 Excel批量转化CSV

Step1. 将要转换的Excel文件放在同一个文件夹里,新建一个空白的Excel文件,右击左下角的Sheet 1,点击“查看代码”(WPS中为开发工具->VBb编辑器)Step2. 在出现的框里填上以下代码,选中之后点击运“运行” Sub xls2csv() Application.DisplayAlerts = False t = ActiveWorkbook.Name mypath = ActiveWorkbook.Path & "\"

2021-08-11 21:31:09 2619 1

原创 解决office关闭更新仍出现“可用的更新Office的更新已准备就绪,但我们首先需要关闭一些应用程序”的问题

解决office关闭更新仍出现“可用的更新Office的更新已准备就绪,但我们首先需要关闭一些应用程序”的问题打开注册表编辑器HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Updates新建UpdatesReadyToApply或者将其值赋空值UpdatesBlockedTime将其值赋空值...

2021-08-08 09:52:32 4703 11

原创 pandas将数据按5分钟平均

详见https://stackoverflow.com/questions/36681945/group-dataframe-in-5-minute-intervals

2020-11-16 21:45:21 1221

原创 手动安装geopandas

在安装geopandas之前,需要安装Shapely、GDAL、Fiona、geopy,前三个可以去https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml下载

2020-11-14 15:51:40 167

原创 利用multiprocessing对pandas的apply并行加速,非groupby操作

import pandas as pdfrom multiprocessing import Poolfrom functools import partialdef dosomething(row): #添加计算操作 return def parallelize(data, func, num_of_processes=8): data_split = np.array_split(data, num_of_processes) poo.

2020-09-13 07:30:59 2614

原创 pandas 将多个dataframe进行merge

pandas 将多个dataframe进行mergeimport pandas as pdfrom functools import reducedfs = [df1, df2, df3]df_final = reduce(lambda left,right: pd.merge(left,right,on='col',how='left'), dfs)

2020-06-21 02:06:00 5643 5

原创 使用multiprocessing Pool 对 pandas groupby apply加速

1.multiprocessing Pool 的使用import multiprocessingdef func(args): # do something return df #返回一个dfif __name__ == "__main__": pool = multiprocessing.Pool() result=pd.DataFrame() result=result.append(pool.map(func,list) ) #给func传..

2020-06-14 14:13:41 2413

原创 python 离线安装依赖包

新建文件夹,打开cmdpip download 包名拷贝到另外一台电脑pip install --no-index --find-links=文件夹路径 包名

2020-06-12 00:53:38 209

原创 pandas pivot 不等长的多列

pandas pivot 不等长的pd.concat([pd.DataFrame({g:d.B.tolist()}) for g,d in df.groupby('A')], axis=1)

2020-06-11 01:59:52 350

原创 使用list循环填充pandas series

使用list循环填充pandas seriesfrom itertools import cycleseq = cycle([1, 2, 3])df['Seq'] = [next(seq) for count in range(df.shape[0])]

2020-06-10 19:16:52 609

原创 pandas apply加速

使用map速度比apply快def func(S1, S2): #do something return #data['similarity'] =pd.Series()data['similarity'] = list(map(func,data['col1'], data['col2']))#data['similarity'] = data.apply(lambda row: func(row['col1'], row['col2']), axis=1)...

2020-06-07 02:48:25 1102

原创 Keras training progress bar 打印新的一行问题

Keras verbose training progress bar writing a new line on each batch issue解决办法:命令行宽度太窄了,把命令行拉宽点。。。

2020-05-31 21:34:27 338

原创 tensorflow 2.X Failed to load the native TensorFlow runtime 问题解决

ImportError: DLL load failed: The specified module could not be found.Failed to load the native TensorFlow runtime.解决办法:Go to theMicrosoft Visual C++ downloads,Scroll down the page to the Visual Studio 2015, 2017 and 2019 section.Download and inst.

2020-05-31 21:32:11 4553

原创 Fluent Terminal 添加右键打开

添加鼠标右键菜单新建文本,将以下脚本复制到文本中,另存为Install.bat,双击打开Install.bat即可reg add "HKCU\Software\Classes\Directory\shell\Open Fluent Terminal here\command" /d "\"%LOCALAPPDATA%\Microsoft\WindowsApps\flute.exe\" new \"%%1\"" /freg add "HKCU\Software\Classes\Director.

2020-05-30 17:17:01 2745 3

原创 离线安装tensorflow-1.15.3所需要的依赖包

λ pip install "C:\Users\Administrator\Desktop\tf\tensorflow-1.15.3-cp37-cp37m-win_amd64.whl"Processing c:\users\administrator\desktop\tf\tensorflow-1.15.3-cp37-cp37m-win_amd64.whlRequirement already satisfied: google-pasta>=0.1.6 in c:\anaconda3\lib\s

2020-05-30 16:32:46 3282

原创 pandas groupby apply 并行处理

from joblib import Parallel, delayeddef processParallel(df,name): #处理数据,如果不加name,return的data没有group信息 return datadef applyParallel(dfGrouped, func): retLst = Parallel(n_jobs=6)(delayed(func)(group,name) for name, group in dfGrouped) ret..

2020-05-29 20:29:36 2853

原创 pandas 按频率排序

order=staypoint['label'].value_counts().reset_index() #统计频率order=order.apply(lambda row: row.name, axis=1) #按出现频率从高到低赋索引值areamap=dict(order[['index','label']].values.tolist())#生成dictstaypoint['label']=staypoint['label'].map(areamap) #赋值...

2020-05-29 20:23:48 1893

原创 GridSearchCV调参

from sklearn import datasetsfrom sklearn.model_selection import train_test_splitfrom sklearn.model_selection import GridSearchCVfrom sklearn.metrics import classification_reportfrom sklearn.svm i...

2020-03-18 19:44:56 481

原创 pandas查找出dataframe中任意一个字段含有空值的一行

pandas查找出dataframe中任意一个字段含有空值的一行df[df.isnull().T.any()]

2020-03-10 16:39:07 1615

原创 解决Microsoft Visual C++ 14.0 is required 以及 'cl.exe' 相关问题

使用pip安装package时报错:1. Microsoft Visual C++ 14.0 is required.2.'cl.exe' failed: No such file or directory3. 'cl.exe' failed with exit status可使用以下方式解决:1. 安装Visual Studio的最新版Build Tools (https:...

2019-11-23 18:50:09 928 1

原创 conda环境管理

查看当前存在哪些虚拟环境conda env list 创建python版本为X.X、名字为your_env_name的虚拟环境conda create -n your_env_name python=X.X激活虚拟环境。activate your_env_name(虚拟环境名称)对虚拟环境中安装额外的包conda install -n your_env_nam...

2019-11-23 18:27:33 96

原创 解决RuntimeError: b'no arguments in initialization list' 问题

使用geopandas进行坐标系转换时,报错RuntimeError: b'no arguments in initialization list' 问题是由proj造成的,可以通过更新proj修复pip install --ignore-installed pyproj==2.4.0...

2019-11-02 17:20:35 1737 1

原创 解决read_csv读取中文文件名、路径报错OSError: Initializing from file failed问题

pandas read_csv直接读取含中文的文件名(或者中文路径)会报错OSError: Initializing from file failed解决办法:f= open(r"中文路径")df= pd.read_csv(f)

2019-09-27 15:59:17 317

原创 解决sqlalchemy连接oracle中文显示乱码问题

设置环境变量os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.AL32UTF8'oralce 服务端编码可以通过select userenv('language') from dual;查询

2019-09-27 01:47:40 683

转载 使用python绘制小猪佩奇

 转自“Python开发者”from turtle import*def nose(x,y):#鼻子 penup()#提起笔 goto(x,y)#定位 pendown()#落笔,开始画 setheading(-30)#将乌龟的方向设置为to_angle/为数字(0-东、90-北、180-西、270-南) begin_fill()#准备开始填充图形...

2019-01-25 13:51:21 290

原创 Anaconda Navigator下载packages缓慢的解决办法

1、挂全局代理2、管理员方式运行Anaconda Navigator

2018-12-20 09:35:38 5951

原创 dict使用values值排序,保留values最大的前几个数

对python的dict数据类型使用values值排序,保留values最大的前几个数 import pandas as pddic={'3':97,'4':99,'5':99,'6':100,'7':99,'8':99}l=sorted(dic.items(), key=lambda dic:dic[1],reverse=True) for i in range(length...

2018-12-20 09:31:33 1202

原创 使用pandas 求内积

经常用到pandas处理以下场景的数据,先求内积,即两列数相乘求和,然后再除以一列数之和,从而实现用一列数对另外一列数加权求和的目的import pandas as pdresult=(df[['A','B',"C"]].groupby(['A']).apply(lambda x: x.prod(axis=1).sum())/df.groupby(['A'])['C'].sum())....

2018-12-19 22:56:51 4281

TENSORFLOW_MACHINE_LEARNING_COOKBOOK

TENSORFLOW_MACHINE_LEARNING_COOKBOOK 电子版 高清 非扫描版

2018-01-13

Hands-On Machine Learning with Scikit-Learn and TensorFlow

Hands-On Machine Learning with Scikit-Learn and TensorFlow 机器学习手册 高清电子版 非扫描版

2018-01-13

Learning Jupyter

Learning Jupyter.pdf 电子版 高清 非扫描版 有目录 有书签

2018-01-13

IPYTHON INTERACTIVE COMPUTING AND VISUALIZATION COOKBOOK

A comprehensive tutorial covering the state-of-the-art methods you can utilize in IPython, including various real-world examples to help you learn in a practical and effective manner. The book illustrates topics in applied mathematics, scientific modeling, and statistical learning., This book is intended for anyone who wants to use Python as a scripting language for general purpose programming and data analysis. You will find the book particularly useful if you're an experienced Python user looking to take the next step, or if you want to quickly get up to speed with IPython's unique features for data visualization.

2018-01-13

用scikit-learn掌握机器学习Mastering Machine Learning With scikit-learn

用scikit-learn掌握机器学习Mastering Machine Learning With scikit-learn 高清 非扫描版

2018-01-13

PYTHON数据可视化编程实战PDF

PYTHON数据可视化编程实战PDF版,清晰扫描版共267页

2016-04-07

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除