2020年11月5日

python数据处理——取dataframe的一列或一行

摘要: df['w'] #选择表格中的'w'列,使用类字典属性,返回的是Series类型 df.w #选择表格中的'w'列,使用点属性,返回的是Series类型 df[['w']] #选择表格中的'w'列,返回的是DataFrame属性 data[0:2] #返回第1行到第2行的所有行,前闭后开,包括前不包 阅读全文

posted @ 2020-11-05 10:07 飞翔的南瓜 阅读(36081) 评论(0) 推荐(0) 编辑

2020年10月27日

df1 = df.drop(index = df[df['侧向加速度响应时间'].isna()].index) #删除是nan的数值

摘要: df1 = df.drop(index = df[df['侧向加速度响应时间'].isna()].index) #删除是nan的数值使用isna进行判断,效果刚刚的,其余的办法经常报错 阅读全文

posted @ 2020-10-27 09:32 飞翔的南瓜 阅读(375) 评论(0) 推荐(0) 编辑

2020年10月23日

np.mean() 中的 axis =0 是指对列进行求均值, axis=1是指对行求均值

摘要: a = [1,2,3] ...: b = [4,5,6] ...: e = np.array(list(zip(a,b))) ...: print(e) ...: print(np.mean(e,axis=0)) ...: print(np.mean(e, axis=1)) ...: [[1 4] 阅读全文

posted @ 2020-10-23 09:19 飞翔的南瓜 阅读(1770) 评论(0) 推荐(0) 编辑

2020年10月22日

pandas 统计某一列中各个值的出现次数

摘要: 比如说有一个名为 df1 的dataframe要统计某一列(比如说列名是city)中各个值出现的次数 #可以通过df.colname 来指定某个列,value_counts()在这里进行计数 df2 = df1.city.value_counts() print(df2) 1 2 3 还有一个是统计 阅读全文

posted @ 2020-10-22 09:45 飞翔的南瓜 阅读(19273) 评论(0) 推荐(1) 编辑

2020年3月31日

改变Dataframe的列的数据类型

摘要: 1、查看DataFrame的数据类型 df.dtypes#查看各列数据类型 df[A].dtypes#查看A列数据类型 2、转换DataFrame的数据类型 df[A].astypes(int)#将A列数据类型转换为intdata['note_n'] = pd.to_numeric(data['no 阅读全文

posted @ 2020-03-31 08:53 飞翔的南瓜 阅读(15540) 评论(0) 推荐(0) 编辑

2020年1月30日

用Python添加写入数据到已经存在的Excel的xlsx文件

摘要: https://www.cnblogs.com/lelexiong/p/8994037.html 阅读全文

posted @ 2020-01-30 19:59 飞翔的南瓜 阅读(1358) 评论(0) 推荐(0) 编辑

python 字符串操作

摘要: https://www.cnblogs.com/huangcong/archive/2011/08/29/2158268.html 阅读全文

posted @ 2020-01-30 17:54 飞翔的南瓜 阅读(106) 评论(0) 推荐(0) 编辑

python遍历文件目录、批量处理同类文件

摘要: https://www.jb51.net/article/168935.htm 阅读全文

posted @ 2020-01-30 16:20 飞翔的南瓜 阅读(323) 评论(0) 推荐(0) 编辑

2020年1月29日

Python_matplotlib画图时图例说明(legend)放到图像外侧

摘要: https://blog.csdn.net/Poul_henry/article/details/82533569 import matplotlib.pyplot as plt import numpy as np x = np.arange(10) print x fig = plt.figur 阅读全文

posted @ 2020-01-29 20:33 飞翔的南瓜 阅读(5970) 评论(0) 推荐(0) 编辑

Python:(使用matplotlib画图)次坐标轴,两个坐标轴

摘要: https://blog.csdn.net/Poul_henry/article/details/82533569 阅读全文

posted @ 2020-01-29 20:05 飞翔的南瓜 阅读(5668) 评论(0) 推荐(0) 编辑

导航