[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
<>pandas模块
pandas是一个强大的分析结构化数据的工具集;它的使用基础是Numpy(提供高性能的矩阵运算);用于数据挖掘和数据分析,同时也提供数据清洗功能。
Pandas中常见的数据结构有两种:
SeriesDateFrame
类似一维数组的对象,类似多维数组/表格数组;每列数据可以是不同的类型;索引包括列索引和行索引。
Series
* 构建Series:ser_obj = pd.Series(range(10))
* 由索引和数据组成(索引在左<自动创建的>,数据在右)。
* 获取数据和索引:ser_obj.index; ser_obj.values
* 预览数据: ser_obj.head(n);ser_obj.tail(n)
DateFrame
* 获取列数据:df_obj[col_idx]或df_obj.col_idx
* 增加列数据:df_obj[new_col_idx] = data
* 删除列:del df_obj[col_idx]
* 按值排序:sort_values(by = “label_name”)
常用方法
Count非NA值得数量
describe针对Series或各DataFrame列计算汇总统计
min\max计算最小值和最大值
argmin\argmax计算能够获取到最大值或最小值的索引位置
idxmin\idxmax计算能够获取到最小值和最大值的索引值
quantile计算样本的分位数(0-1)
sum值得总和
mean值得平均值
median值的算术中位数(50%分位数)
mad根据平均值计算平均绝对离差
var样本值得方差
std样本值得标准差
skew样本值的偏度(三阶距)
kurt样本值的峰度(四阶距)
cumsum样本值的累计和
cummin\cummax样本值的累计最大值和累计最小值
cumprod样本值的累计积
diff计算一阶差分(对时间序列很有用)
pct_change计算百分数变化
处理缺失数据
* Dropna()丢弃缺失数据
* Fillna()填充缺失数据
数据过滤
Df[filter_condition]依据filter_condition(条件)对Df(数据)进行过滤。
绘图功能
Plot(kind,x,y,title,figsize)
Kind(绘制什么形式的图),x(x轴内容),y(y轴内容),title(图标题),figsize(图大小)
保存图片:plt.savefig()
("The fool doth think he is wise, but the wise man knows himself to be a
fool." --威廉·莎士比亚)