Pandas基础

AAI脑图#4058912024-12-01 03:21
28000

内容详情

介绍

什么是Pandas

�装Pandas

�入Pandas库

数据结构

Series(一维数组)

DataFrame(二维表格型数据结构)

创建数据结构

创建Series

创建DataFrame

从列表、字典、NumPy数组等创建

查看数据

head()

tail()

info()

describe()

选择数据

通过标签选择:loc[]

通过位置选择:iloc[]

通过布尔索引选择

选择特定列或行

�理缺失数据

�测缺失值:isnull(), notnull()

删除缺失值:dropna()

�充缺失值:fillna()

数据过滤与排序

�滤数据

�序数据:sort_values(), sort_index()

数据清洗

重命名轴:rename()

�换值:replace()

删除重复项:drop_duplicates()

数据转换

�用函数到数据:apply()

�射函数:map()

添加/删除列

数据类型转换:astype()

数据聚合

分组:groupby()

�合函数:sum(), mean(), count(), max(), min()

�级分组

数据合并

�并(merge):merge()

�接(concatenate):concat()

�加行:append()

时间序列

创建日期范围:date_range()

时间戳与时期:Timestamp, Period

重采样:resample()

�动窗口:rolling()

文件读写

读取CSV文件:read_csv()

�入CSV文件:to_csv()

读取Excel文件:read_excel()

�入Excel文件:to_excel()

读写HDF5文件:read_hdf(), to_hdf()

读写SQL数据库:read_sql(), to_sql()

�视化

使用Matplotlib绘图

�单图表:plot()

�方图:hist()

�点图:scatter()

�形图:bar()

�级功能

自定义函数

�性能选项

使用Cython加速