利用Python进行数据分析
文章平均质量分 50
赵孝正
python爱好者
展开
-
pandas使用分位数+控制变量法进行多条件数据筛选
pandas使用分位数筛选满足条件的行原创 2023-11-16 13:20:06 · 368 阅读 · 0 评论 -
3.1数据结构和序列(利用Python进行数据分析)
数据结构和序列原创 2022-12-05 10:05:20 · 722 阅读 · 0 评论 -
python将字符串数组转换为浮点数数组
python将字符串数组转换为浮点数数组原创 2022-09-20 11:19:55 · 3862 阅读 · 0 评论 -
python在resample后用agg对多列使用自定义函数
python在resample后用agg对多列使用自定义函数原创 2022-07-06 21:44:02 · 1432 阅读 · 0 评论 -
python求列表均值,方差,标准差,numpy.sum()
python求列表均值,方差,标准差,numpy.sum()原创 2022-07-06 21:08:22 · 6834 阅读 · 1 评论 -
python计算斜率以及给定一组点两两求斜率
python计算斜率以及给定一组点两两求斜率原创 2022-07-05 17:03:11 · 10914 阅读 · 0 评论 -
DataFrame按照每行或每列转成List
DataFrame按照每行或每列转成List原创 2022-07-05 09:30:11 · 3706 阅读 · 0 评论 -
python字典dict和DataFrame、Series之间的相互转换
Python字典和DataFrame之间的相互转换原创 2022-06-28 16:01:06 · 2607 阅读 · 0 评论 -
python利用pandas获取每行数据的最大值,最小值以及对应的columns
python利用pandas获取每行数据的最大值,最小值以及对应的columns原创 2022-06-23 13:04:21 · 4143 阅读 · 0 评论 -
详解python重采样与频率转换之resample()
重采样与频率转换原创 2022-06-23 10:16:33 · 3034 阅读 · 0 评论 -
AttributeError: module ‘pandas‘ has no attribute ‘TimeGrouper‘
之后我们可以设置时间索引,按'key'和time_key进行分组,再聚合:原创 2022-06-22 20:28:26 · 1650 阅读 · 0 评论 -
对数坐标绘制与理解
利用python画对数坐标,以及对数坐标的理解原创 2022-06-14 13:30:29 · 5970 阅读 · 0 评论 -
python使用pd.to_numeric()方法将数据转为数字类型int或float
pandas.to_numeric()原创 2022-06-03 19:14:08 · 12241 阅读 · 1 评论 -
python导出json文件报错TypeError: Object of type Timestamp is not JSON serializable
运行下面代码import jsonimport datetimeclass NpEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, np.integer): return int(obj) elif isinstance(obj, np.floating): return float(obj) elif is.原创 2022-05-28 10:36:31 · 1544 阅读 · 0 评论 -
TypeError: Object of type int64 is not JSON serializable
在使用json格式保存数据时,经常会遇到xxx is not JSON serializable,也就是无法序列化某些对象格式,我所遇见的是我使用了numpy时,使用了np的数据格式,写入data后,json.dumps(data)失败,我们可以自己定定义对特定类型的对象的序列化,下面看下怎么定义和使用关于np数据类型的自定义。class NpEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj,原创 2022-05-28 08:27:24 · 9050 阅读 · 0 评论 -
用python将dataframe将中的两列处理成行索引和列索引
dataframe设为 frame,其中三列分别为 year,month,ws目标变成构建dataframedata = {'year': [2000,2000,2000, 2001,2001,2001, 2002,2002,2002, 2003, 2003, 2003], 'month': [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3,], 'ws':np.random.randint(7, size=12)}frame = pd.Dat原创 2022-05-26 21:40:41 · 2982 阅读 · 1 评论 -
详解Python的transpose函数
数组转置和换轴import numpy as np>>> arr = np.arange(16).reshape((2,2,4))array([[[ 0, 1, 2, 3], [ 4, 5, 6, 7]], [[ 8, 9, 10, 11], [12, 13, 14, 15]]])>>> arr.transpose((1,0,2))array([[[ 0, 1, 2, 3],原创 2022-03-03 09:53:23 · 10334 阅读 · 2 评论