python - pandas 之 references - api references 官方文档

宦兴朝
2023-12-01

目录

1.官方文档 及 基础教程

2.Pandas API Reference 官方文档目录

3.Pandas Input/Output API目录

4.Dataframe API Catalog

5.Series API Catalog


 

1.官方文档 及 基础教程

1.pandas官方文档

  • http://pandas.pydata.org/pandas-docs/stable/index.html

2.十分搞定pandas

  • http://www.cnblogs.com/chaosimple/p/4153083.html
  • 简单介绍dataframe的创建,增删改查,数据清洗,简单统计的内容,画图等,内容较全,宜于入门学习

3.pandas :让你像写SQL一样做数据分析

  • http://www.cnblogs.com/en-heng/p/5630849.html
  • 介绍pandas如何实现SQL基础操作方法

4.Pandas 数据框增、删、改、查、去重、抽样基本操作

  • http://blog.csdn.net/claroja/article/details/65661826

 

2.Pandas API Reference 官方文档目录

 

3.Pandas Input/Output API目录

 

4.Dataframe API Catalog

官方参考URL:  https://pandas.pydata.org/pandas-docs/stable/reference/frame.html

1.构造函数

  • DataFrame([data,index,columns,dtype,copy]) 具有标记轴(行和列)的二维大小可变,可能异构的表格数据结构。

 

2.属性和基础数据

  • DataFrame.index DataFrame的索引(行标签)。
  • DataFrame.columns DataFrame的列标签。
  • DataFrame.dtypes 返回DataFrame中各列的dtypes。
  • DataFrame.ftypes 返回DataFrame中的ftypes(稀疏/密集和dtype的指示)。
  • DataFrame.get_dtype_counts() 统计各dtypes的数量。
  • DataFrame.get_ftype_counts() 统计各ftypes的数量。
  • DataFrame.select_dtypes() 选择dataFrame中指定dtypes的列。
  • DataFrame.values 返回DataFrame的Numpy表示。
  • DataFrame.get_values() 将稀疏值转换为密集后返回一个ndarray。
  • DataFrame.axes 返回表示DataFrame轴的列表。
  • DataFrame.ndim 返回表示dataframe维数,2维居多.
  • DataFrame.size 返回dataframe对象中的元素数。
  • DataFrame.shape 返回表示DataFrame维度的元组。
  • DataFrame.memory_usage() 以字节为单位返回每列的内存使用情况。
  • DataFrame.empty 判断DataFrame对象是否为空。
  • DataFrame.is_copy 返回副本。
  • DataFrame.T 转置

 

3.转换

  • DataFrame.astype(dtype) 将pandas对象转换为指定的dtype dtype。
  • DataFrame.convert_objects() (DEPRECATED)尝试推断对象列的更好dtype。
  • DataFrame.infer_objects() 尝试推断对象列的更好的dtypes。
  • DataFrame.copy() 深拷贝此对象的索引和数据。
  • DataFrame.isna() 检测缺失值。
  • DataFrame.notna() 检测现有(非缺失)值。
  • DataFrame.bool() 返回单个元素PandasObject的bool。

 

4.索引,迭代

  • DataFrame.head([N]) 返回前n行。
  • DataFrame.at 访问行/列标签对的单个值。
  • DataFrame.iat 按整数位置访问行/列对的单个值。
  • DataFrame.loc 按标签或布尔数组访问一组行和列。
  • DataFrame.iloc 纯粹基于整数位置的索引,用于按位置选择。
  • DataFrame.insert(loc,column,value) 将列插入指定位置的DataFrame。
  • DataFrame.__iter__() 迭代infor轴
  • DataFrame.items() 迭代器(列名,系列)对。
  • DataFrame.keys() 获取“信息轴”(请参阅​​索引以获取更多信息)
  • DataFrame.iteritems() 迭代器(列名,系列)对。
  • DataFrame.iterrows() 迭代DataFrame行作为(索引,系列)对。
  • DataFrame.itertuples([index,name]) 将DataFrame行作为namedtuples迭代[遍历各行]。
  • DataFrame.lookup(row_labels,col_labels) DataFrame的基于标签的“花式索引”功能。
  • DataFrame.pop() 返回项目并从框架中删除。
  • DataFrame.tail([N]) 返回最后n行。
  • DataFrame.xs() 返回Series / DataFrame的横截面。
  • DataFrame.get() 从给定键的对象获取项目(DataFrame列,Panel切片等)。
  • DataFrame.isin() DataFrame中的每个元素是否都包含在值中。
  • DataFrame.where() 替换条件为False的值。
  • DataFrame.mask() 替换条件为True的值。
  • DataFrame.query() 使用布尔表达式查询DataFrame的列。

 

5.二元运算符函数

  • DataFrame.add() 添加数据帧和其他元素(二元运算符添加)。
  • DataFrame.sub() 减去数据帧和其他元素(二元运算符子)。
  • DataFrame.mul() 数据帧和其他元素的乘法(二元运算符mul)。
  • DataFrame.div() 浮动划分数据帧和元素方式(二元运算符truediv)。
  • DataFrame.truediv() 浮动划分数据帧和元素方式(二元运算符truediv)。
  • DataFrame.floordiv() 数据帧和其他元素的整数划分(二元运算符floordiv)。
  • DataFrame.mod() 数据帧的模数和其他元素(二元运算符mod)。
  • DataFrame.pow() 数据帧和其他元素的指数幂(二元运算符pow)。
  • DataFrame.dot() 计算DataFrame和其他之间的矩阵多重。
  • DataFrame.radd() 添加数据帧和其他元素(二元运算符radd)。
  • DataFrame.rsub() 减去数据帧和其他元素(二元运算符rsub)。
  • DataFrame.rmul() 数据帧和其他元素的乘法(二元运算符rmul)。
  • DataFrame.rdiv() 浮动划分数据帧和其他元素(二元运算符rtruediv)。
  • DataFrame.rtruediv() 浮动划分数据帧和其他元素(二元运算符rtruediv)。
  • DataFrame.rfloordiv() 数据帧和其他元素的整数划分(二元运算符rfloordiv)。
  • DataFrame.rmod() 数据帧的模数和其他元素(二元运算符rmod)。
  • DataFrame.rpow() 数据帧和其他元素的指数幂(二元运算符rpow)。
  • DataFrame.lt() 少于数据帧和其他元素(二元运算符lt)。
  • DataFrame.gt() 大于数据帧和其他元素(二元运算符gt)。
  • DataFrame.le() 小于或等于数据帧等,逐元素(二元运算乐)。
  • DataFrame.ge() 大于或等于数据帧和其他元素(二元运算符ge)。
  • DataFrame.ne() 不等于数据帧和其他元素(二元运算符ne)。
  • DataFrame.eq() 等于数据帧和其他元素(二元运算符eq)。
  • DataFrame.combine() 基于传递的函数执行与另一个DataFrame的逐列组合。
  • DataFrame.combine_first() 更新与null值的元素在同一地点等。

 

6.功能应用程序,GroupBy

  • DataFrame.apply() 沿DataFrame的轴应用函数。
  • DataFrame.applymap() 将函数元素应用于Dataframe。
  • DataFrame.pipe() 应用func(self,* args,** kwargs)。
  • DataFrame.agg() 使用指定轴上的一个或多个操作进行聚合。
  • DataFrame.aggregate() 使用指定轴上的一个或多个操作进行聚合。
  • DataFrame.transform() 调用func自生成具有变换值的DataFrame并且具有与self相同的轴长度。
  • DataFrame.groupby() 使用映射器或一系列列对DataFrame或Series进行分组。
  • DataFrame.rolling() 提供滚动窗口计算。
  • DataFrame.expanding() 提供扩展转换。
  • DataFrame.ewm() 提供指数加权函数。

 

7.计算/描述性统计

  • DataFrame.abs() 返回具有每个元素的绝对数值的Series / DataFrame。
  • DataFrame.all() 返回是否所有元素都是True,可能是在轴上。
  • DataFrame.any() 返回任何元素是否为True,可能是在轴上。
  • DataFrame.clip() 在输入阈值处修剪值。
  • DataFrame.compound() 返回请求轴的值的复合百分比。
  • DataFrame.corr() 计算列的成对相关性,不包括NA / null值。
  • DataFrame.corrwith() 使用Series或DataFrame的行或列计算DataFrame的行或列之间的成对关联。
  • DataFrame.count() 计算每列或每行的非NA单元格。
  • DataFrame.cov() 计算列的成对协方差,不包括NA / null值。
  • DataFrame.cummax() 返回DataFrame或Series轴上的累积最大值。
  • DataFrame.cummin() 返回DataFrame或Series轴上的累积最小值。
  • DataFrame.cumprod() 通过DataFrame或Series轴返回累积产品。
  • DataFrame.cumsum() 返回DataFrame或Series轴上的累积和。
  • DataFrame.describe() 生成描述性统计数据,总结数据集分布的集中趋势,分散和形状,不包括NaN值。
  • DataFrame.diff() 第一个离散的元素差异。
  • DataFrame.eval() 评估描述DataFrame列上的操作的字符串。
  • DataFrame.kurt() 使用Fisher对峰度的定义(正常峰度== 0.0),在请求的轴上返回无偏峰度。
  • DataFrame.kurtosis() 使用Fisher对峰度的定义(正常峰度== 0.0),在请求的轴上返回无偏峰度。
  • DataFrame.mad() 返回请求轴的值的平均绝对偏差。
  • DataFrame.max() 返回请求轴的最大值。
  • DataFrame.mean() 返回请求轴的值的平均值。
  • DataFrame.median() 返回请求轴的值的中值。
  • DataFrame.min() 返回请求轴的最小值。
  • DataFrame.mode() 获取沿所选轴的每个元素的模式。
  • DataFrame.pct_change() 当前元素和先前元素之间的百分比变化。
  • DataFrame.prod() 返回请求轴的值的乘积。
  • DataFrame.product() 返回请求轴的值的乘积。
  • DataFrame.quantile() 在请求的轴上返回给定分位数的值。
  • DataFrame.rank() 沿轴计算数值数据等级(1到n)。
  • DataFrame.round() 将DataFrame舍入到可变数量的小数位。
  • DataFrame.sem() 在请求的轴上返回均值的无偏标准误差。
  • DataFrame.skew() 返回请求轴的无偏偏差,由N-1归一化。
  • DataFrame.sum() 返回请求轴的值的总和。
  • DataFrame.std() 返回请求轴上的样本标准偏差。
  • DataFrame.var() 在请求的轴上返回无偏差异。
  • DataFrame.nunique() 计算对请求轴的不同观察结果。

 

8.重新索引/选择/标签操作

  • DataFrame.add_prefix() 带有字符串前缀的前缀标签。
  • DataFrame.add_suffix() 带有字符串后缀的后缀标签。
  • DataFrame.align() 使用指定的每个轴索引的连接方法将轴上的两个对象对齐。
  • DataFrame.at_time() 在特定时间选择值(例如,
  • DataFrame.between_time() 选择一天中特定时间之间的值(例如,上午9:00-9:30)。
  • DataFrame.drop() 从行或列中删除指定的标签。
  • DataFrame.drop_duplicates() 返回删除了重复行的DataFrame,可选择仅考虑某些列。
  • DataFrame.duplicated() 返回boolean Series表示重复行,可选择仅考虑某些列。
  • DataFrame.equals() 测试两个对象是否包含相同的元素。
  • DataFrame.filter() 根据指定索引中的标签设置数据框的行或列。
  • DataFrame.first() 基于日期偏移量对初始时间序列数据的子集进行子集化的便捷方法。
  • DataFrame.head() 返回前n行。
  • DataFrame.idxmax() 返回请求轴上第一次出现最大值的索引。
  • DataFrame.idxmin() 返回首次出现最小请求轴的索引。
  • DataFrame.last() 基于日期偏移量化时间序列数据的最终时段的便捷方法。
  • DataFrame.reindex() 使用可选填充逻辑将DataFrame符合到新索引,将NA / NaN放置在先前索引中没有值的位置。
  • DataFrame.reindex_axis() (DEPRECATED)将输入对象符合新索引。
  • DataFrame.reindex_like() 返回具有匹配索引的对象作为其他对象。
  • DataFrame.rename() 更改轴标签。
  • DataFrame.rename_axis() 设置索引或列的轴名称。
  • DataFrame.reset_index() 重置索引或其级别。
  • DataFrame.sample() 从对象轴返回随机的项目样本。
  • DataFrame.select() (DEPRECATED)返回与轴标签匹配条件对应的数据。
  • DataFrame.set_axis() 将所需索引分配给给定轴。
  • DataFrame.set_index() 使用现有列设置DataFrame索引。
  • DataFrame.tail() 返回最后n行。
  • DataFrame.take() 沿轴返回给定位置索引中的元素。
  • DataFrame.truncate() 在某个索引值之前和之后截断一个Series或DataFrame。

 

9.缺少数据处理

  • # DataFrame.dropna() 删除缺失值。
  • # DataFrame.fillna() 使用指定的方法填充NA / NaN值。
  • # DataFrame.replace() 替换给定的值to_replace与价值。
  • # DataFrame.interpolate() 根据不同的方法插值。

 

10.重塑,排序,转置

  • DataFrame.droplevel() 返回DataFrame,删除请求的索引/列级别。
  • DataFrame.pivot() 返回由给定索引/列值组织的重新整形的DataFrame。
  • DataFrame.pivot_table() 创建一个电子表格样式的数据透视表作为DataFrame。
  • DataFrame.reorder_levels() 使用输入顺序重新排列索引级别。
  • # DataFrame.sort_values() 按任一轴的值排序。
  • DataFrame.sort_index() 按标签排序对象(沿轴)。
  • DataFrame.nlargest() 返回第一个ñ通过有序的行列按降序排列。
  • DataFrame.nsmallest() 返回第一个ñ通过有序的行列按升序排列。
  • DataFrame.swaplevel() 在特定轴上的MultiIndex中交换i和j级别。
  • DataFrame.stack() 将指定级别从列堆叠到索引。
  • DataFrame.unstack() 透视索引标签的级别,返回具有新级别列标签的DataFrame,其最内层级别由透视索引标签组成。
  • DataFrame.swapaxes() 交换轴和交换值轴适当。
  • DataFrame.melt() 将DataFrame从宽格式展开为长格式,可选择保留标识符变量集。
  • DataFrame.squeeze() 将1维轴对象压缩为标量。
  • DataFrame.to_panel() (DEPRECATED)将长(堆叠)格式(DataFrame)转换为宽(3D,Panel)格式。
  • DataFrame.to_xarray() 从pandas对象返回一个xarray对象。
  • DataFrame.T 转置索引和列。
  • DataFrame.transpose() 转置索引和列。

 

11.合并/加入/合并

  • # DataFrame.append() 将其他行附加到调用者的末尾,返回一个新对象。
  • # DataFrame.assign() 将新列分配给DataFrame。
  • # DataFrame.join() 加入另一个DataFrame的列。
  • # DataFrame.merge() 使用数据库样式连接合并DataFrame或命名的Series对象。
  • # DataFrame.update() 使用另一个DataFrame中的非NA值进行就地修改。

 

12.时间序列相关

  • DataFrame.asfreq() 将TimeSeries转换为指定的频率。
  • DataFrame.asof() 返回前最后一行(S)没有任何NaN的地方。
  • DataFrame.shift() 使用可选的时间频率按期望的周期数移动索引。
  • DataFrame.slice_shift() 相当于移位而不复制数据。
  • DataFrame.tshift() 使用索引的频率(如果可用)移动时间索引。
  • DataFrame.first_valid_index() 返回第一个非NA / null值的索引。
  • DataFrame.last_valid_index() 返回最后一个非NA / null值的索引。
  • DataFrame.resample() 重新采样时间序列数据。
  • DataFrame.to_period() 将DataFrame从DatetimeIndex转换为具有所需频率的PeriodIndex(如果未传递,则从索引推断)。
  • DataFrame.to_timestamp() 在句点开头转换为时间戳的DatetimeIndex 。
  • DataFrame.tz_convert() 将tz感知轴转换为目标时区。
  • DataFrame.tz_localize() 将Series或DataFrame的tz-naive索引本地化为目标时区。

 

13.绘图

  • DataFrame.plot() DataFrame绘制访问器和方法
  • DataFrame.plot.area() 绘制堆积区域图。
  • DataFrame.plot.bar() 垂直条形图。
  • DataFrame.plot.barh() 制作水平条形图。
  • DataFrame.plot.box() 制作DataFrame列的方框图。
  • DataFrame.plot.density() 使用高斯核生成核密度估计图。
  • DataFrame.plot.hexbin() 生成六边形分箱图。
  • DataFrame.plot.hist() 绘制DataFrame列的一个直方图。
  • DataFrame.plot.kde() 使用高斯核生成核密度估计图。
  • DataFrame.plot.line() 将DataFrame列绘制为线条。
  • DataFrame.plot.pie() 生成饼图。
  • DataFrame.plot.scatter() 创建具有不同标记点大小和颜色的散点图。
  • DataFrame.boxplot() 从DataFrame列创建一个箱形图。
  • DataFrame.hist() 制作DataFrame的直方图。

 

14.序列化/ IO /转换

  • DataFrame.from_dict() 从类似数组或dicts的dict构造DataFrame。
  • DataFrame.from_items() (DEPRECATED)从元组列表构造DataFrame。
  • DataFrame.from_records() 将结构化或记录ndarray转换为DataFrame。
  • DataFrame.info() 打印DataFrame的简明摘要。
  • DataFrame.to_parquet() 将DataFrame写入二进制镶木地板格式。
  • DataFrame.to_pickle() Pickle(序列化)对象到文件。
  • DataFrame.to_csv() 将对象写入逗号分隔值(csv)文件。
  • DataFrame.to_hdf() 使用HDFStore将包含的数据写入HDF5文件。
  • DataFrame.to_sql() 将存储在DataFrame中的记录写入SQL数据库。
  • DataFrame.to_dict() 将DataFrame转换为字典。
  • DataFrame.to_excel() 将对象写入Excel工作表。
  • DataFrame.to_json() 将对象转换为JSON字符串。
  • DataFrame.to_html() 将DataFrame呈现为HTML表格。
  • DataFrame.to_feather() 写出DataFrames的二进制羽毛格式。
  • DataFrame.to_latex() 将对象渲染到LaTeX表格环境表。
  • DataFrame.to_stata() 将DataFrame对象导出为Stata dta格式。
  • DataFrame.to_msgpack() 使用msgpack格式将对象序列化为输入文件路径。
  • DataFrame.to_gbq() 将DataFrame写入Google BigQuery表。
  • DataFrame.to_records() 将DataFrame转换为NumPy记录数组。
  • DataFrame.to_sparse() 转换为SparseDataFrame。
  • DataFrame.to_dense() 返回NDFrame的密集表示(与稀疏相反)。
  • DataFrame.to_string() 将DataFrame渲染为控制台友好的表格输出。
  • DataFrame.to_clipboard() 将对象复制到系统剪贴板。
  • DataFrame.style 返回Styler对象的属性,该对象包含用于为DataFrame构建样式化HTML表示的方法

15.稀疏

  • SparseDataFrame.to_coo() 将帧的内容作为稀疏的SciPy COO矩阵返回。

 

5.Series API Catalog

官方参考URL: https://pandas.pydata.org/pandas-docs/stable/reference/series.html

1.构造函数

  • Series([data,index,dtype,name,copy,...]) 带轴标签的一维ndarray(包括时间序列)

 

2.属性

  • Series.index 系列的索引(轴标签)。
  • Series.array 支持此系列或索引的数据的ExtensionArray。
  • Series.values 返回系列为ndarray或ndarray-like取决于dtype。
  • Series.dtype 返回基础数据的dtype对象。
  • Series.ftype 如果数据稀疏则返回。
  • Series.shape 返回基础数据形状的元组。
  • Series.nbytes 返回基础数据中的字节数。
  • Series.ndim 根据定义1,基础数据的维数。
  • Series.size 返回基础数据中的元素数。
  • Series.strides 返回基础数据的步幅。
  • Series.itemsize 返回基础数据项的dtype大小。
  • Series.base 如果共享基础数据的内存,则返回基础对象。
  • Series.T 返回转置,根据定义自我。
  • Series.memory_usage([index,deep]) 返回系列的内存使用情况。
  • Series.hasnans 如果我有任何nans,我会回来; 实现各种性能加速。
  • Series.flags
  • Series.empty
  • Series.dtypes 返回基础数据的dtype对象。
  • Series.ftypes 如果数据稀疏则返回。
  • Series.data 返回基础数据的数据指针。
  • Series.is_copy 退回副本。
  • Series.name 返回系列的名称。
  • Series.put(* args,** kwargs) 将put方法应用于其values属性(如果有)。

 

3.转换

  • Series.astype(dtype [,copy,errors]) 将pandas对象转换为指定的dtype dtype。
  • Series.infer_objects() 尝试推断对象列的更好的dtypes。
  • Series.convert_objects([convert_dates,...]) (DEPRECATED)尝试推断对象列的更好dtype。
  • Series.copy([deep]) 复制此对象的索引和数据。
  • Series.bool() 返回单个元素PandasObject的bool。
  • Series.to_numpy([dtype,copy]) NumPy ndarray表示此系列或索引中的值。
  • Series.to_period([freq,copy]) 将Series从DatetimeIndex转换为具有所需频率的PeriodIndex(如果未传递则从索引推断)。
  • Series.to_timestamp([freq,how,copy]) 在期间开始时转换为时间戳的datetimedex 。
  • Series.to_list() 返回值列表。
  • Series.get_values() 与values相同(但处理稀疏转换); 是一种观点。
  • Series.__array__([dtype]) 将值作为NumPy数组返回。

 

4.索引,迭代

  • Series.get() 从给定键的对象获取项目(DataFrame列,Panel切片等)。
  • Series.at 访问行/列标签对的单个值。
  • Series.iat 按整数位置访问行/列对的单个值。
  • Series.loc 按标签或布尔数组访问一组行和列。
  • Series.iloc 纯粹基于整数位置的索引,用于按位置选择。
  • Series.__iter__() 返回值的迭代器。
  • Series.iteritems() 懒惰地迭代(索引,值)元组。
  • Series.items() 懒惰地迭代(索引,值)元组。
  • Series.keys() 索引的别名。
  • Series.pop(item) 返回项目并从框架中删除。
  • Series.item() 将基础数据的第一个元素作为python标量返回。
  • Series.xs(key[,axis,level,drop_level]) 返回Series/DataFrame的横截面。

 

5.二元运算符函数

  • Series.add(other[,level,fill_value,axis]) 添加series和other元素(二元运算符添加)。
  • Series.sub(other[,level,fill_value,axis]) 减去序列和other元素(二元运算符子)。
  • Series.mul(other[,level,fill_value,axis]) series和other的乘法,元素(二元运算符mul)。
  • Series.div(other[,level,fill_value,axis]) 浮动分裂series和other,元素方式(二元运算符truediv)。
  • Series.truediv(other[,level,fill_value,axis]) 浮动分裂series和other,元素方式(二元运算符truediv)。
  • Series.floordiv(other[,level,fill_value,axis]) series和other的整数除法,元素方式(二元运算符floordiv)。
  • Series.mod(other[,level,fill_value,axis]) series和other的模数,元素方式(二元运算符mod)。
  • Series.pow(other[,level,fill_value,axis]) series和other元素的指数幂(二元运算符pow)。
  • Series.radd(other[,level,fill_value,axis]) 添加series和other元素(二元运算符radd)。
  • Series.rsub(other[,level,fill_value,axis]) series和other元素的减法(二元运算符rsub)。
  • Series.rmul(other[,level,fill_value,axis]) series和other的乘法,元素(二元运算符rmul)。
  • Series.rdiv(other[,level,fill_value,axis]) series和other的浮动划分,元素方式(二元算子rtruediv)。
  • Series.rtruediv(other[,level,fill_value,axis]) series和other的浮动划分,元素方式(二元算子rtruediv)。
  • Series.rfloordiv(other[,level,fill_value,...]) series和other的整数除法,元素方式(二元算子rfloordiv)。
  • Series.rmod(other[,level,fill_value,axis]) series和other的模数,元素方式(二元运算符rmod)。
  • Series.rpow(other[,level,fill_value,axis]) series和other元素的指数幂(二元运算符rpow)。
  • Series.combine(other,func [,fill_value]) 根据功能将series与series或标量组合。
  • Series.combine_first(other) 组合series值,首先选择调用series的值。
  • Series.round([decimals]) 将series中的每个值舍入到给定的小数位数。
  • Series.lt(other[,level,fill_value,axis]) 少于series和other元素(二元运算符lt)。
  • Series.gt(other[,level,fill_value,axis]) 大于series和other元素(二元运算符gt)。
  • Series.le(other[,level,fill_value,axis]) 小于或等于series和other元素(二元运算符le)。
  • Series.ge(other[,level,fill_value,axis]) 大于或等于series和other元素(二元运算符ge)。
  • Series.ne(other[,level,fill_value,axis]) 不等于series和other元素(二元运算符ne)。
  • Series.eq(other[,level,fill_value,axis]) 等于series和other元素(二元运算符eq)。
  • Series.product([axis,skipna,level,...]) 返回请求轴的值的乘积。
  • Series.dot(other) 计算series和other列之间的点积

 

6.功能应用程序,GroupBy&windows

  • Series.apply(func [,convert_dtype,args]) 调用Series的值的函数。
  • Series.agg(func [,axis]) 使用指定轴上的一个或多个操作进行聚合。
  • Series.aggregate(func [,axis]) 使用指定轴上的一个或多个操作进行聚合。
  • Series.transform(func [,axis]) 调用func自生成具有变换值的系列并且具有与self相同的轴长度。
  • Series.map(arg [,na_action]) 根据输入的对应关系映射系列的值。
  • Series.groupby([by,axis,level,as_index,...]) 使用映射器或一系列列对DataFrame或Series进行分组。
  • Series.rolling(window [,min_periods,...]) 提供滚动窗口计算。
  • Series.expanding([min_periods,center,axis]) 提供扩展转换。
  • Series.ewm([com,span,halflife,alpha,...]) 提供指数加权函数。
  • Series.pipe(func,*args,**kwargs) 应用func(self,* args,** kwargs)。

 

7.计算/描述性统计

  • Series.abs() 返回具有每个元素的绝对数值的Series/DataFrame。
  • Series.all([axis,bool_only,skipna,level]) 返回是否所有元素都是True,可能是在axis上。
  • Series.any([axis,bool_only,skipna,level]) 返回任何元素是否为True,可能是在axis上。
  • Series.autocorr([lag]) 计算lag-N自相关。
  • Series.between(left,right[,inclusive]) 返回布尔值系列等效于左<=系列<=右。
  • Series.clip([lower,upper,axis,inplace]) 在输入threshold处修剪值。
  • Series.clip_lower(threshold[,axis,inplace]) (已弃用)修剪低于给定threshold的值。
  • Series.clip_upper(threshold[,axis,inplace]) (已弃用)修剪高于给定threshold的值。
  • Series.corr(other[,method,min_periods]) 计算与other系列的相关性,不包括缺失值。
  • Series.count([level]) 返回系列中非NA/null观测值的返回数。
  • Series.cov(other[,min_periods]) 计算与Series的协方差,不包括缺失值。
  • Series.cummax([axis,skipna]) 返回DataFrame或Seriesaxis上的累积最大值。
  • Series.cummin([axis,skipna]) 返回DataFrame或Seriesaxis上的累积最小值。
  • Series.cumprod([axis,skipna]) 通过DataFrame或Seriesaxis返回累积产品。
  • Series.cumsum([axis,skipna]) 返回DataFrame或Seriesaxis上的累积和。
  • Series.describe([percentiles, include, exclude]) 生成描述性统计数据,总结数据集分布趋势,分散和形状,不包括NaN值。
  • Series.diff([periods]) 第一个离散的元素差异。
  • Series.factorize([sort,na_sentinel]) 将对象编码为枚举类型或分类变量。
  • Series.kurt([axis,skipna,level,numeric_only]) 使用Fisher对峰度的定义(正常峰度== 0.0),在请求的axis上返回无偏峰度。
  • Series.mad([axis,skipna,level]) 返回请求axis的值的平均绝对偏差。
  • Series.max([axis,skipna,level,numeric_only]) 返回请求axis的最大值。
  • Series.mean([axis,skipna,level,numeric_only]) 返回请求axis的值的平均值。
  • Series.median([axis,skipna,level,...]) 返回请求axis的值的中值。
  • Series.min([axis,skipna,level,numeric_only]) 返回请求axis的最小值。
  • Series.mode([dropna]) 返回数据集的模式。
  • Series.nlargest([n,keep]) 返回最大的n个元素。
  • Series.nsmallest([n,keep]) 返回最小的n个元素。
  • Series.pct_change([periods,fill_method,...]) 当前元素和先前元素之间的百分比变化。
  • Series.prod([axis,skipna,level,...]) 返回请求axis的值的乘积。
  • Series.quantile([q,interpolation]) 给定分位数处的返回值。
  • Series.rank([axis,method,numeric_only,...]) 沿axis计算数值数据level(1到n)。
  • Series.sem([axis,skipna,level,ddof,...]) 在请求的axis上返回均值的无偏标准误差。
  • Series.skew([axis,skipna,level,numeric_only]) 返回请求axis的无偏偏差,由N-1归一化。
  • Series.std([axis,skipna,level,ddof,...]) 返回请求axis上的样本标准偏差。
  • Series.sum([axis,skipna,level,...]) 返回请求axis的值的总和。
  • Series.var([axis,skipna,level,ddof,...]) 在请求的axis上返回无偏差异。
  • Series.kurtosis([axis,skipna,level,...]) 使用Fisher对峰度的定义(正常峰度== 0.0),在请求的axis上返回无偏峰度。
  • Series.unique() 返回Series对象的唯一值。
  • Series.nunique([dropna]) 返回对象中唯一元素的数量。
  • Series.is_unique 如果对象中的值是唯一的,则返回布尔值。
  • Series.is_monotonic 如果对象中的值是monotonic_increasing,则返回boolean。
  • Series.is_monotonic_increasing 如果对象中的值是monotonic_increasing,则返回boolean。
  • Series.is_monotonic_decreasing 如果对象中的值是monotonic_decreasing,则返回布尔值。
  • Series.value_counts([normalize,sort,...]) 返回包含唯一值计数的系列。
  • Series.compound([axis,skipna,level]) 返回请求axis的值的复合百分比。

 

8.重新索引/选择/标签操作

  • Series.align(other[, join, axis, level, …]) 使用指定的每个轴索引的连接方法将轴上的两个对象对齐。
  • Series.drop([labels, axis, index, columns, …]) 返回已删除指定索引标签的series。
  • Series.droplevel(level[, axis]) 返回DataFrame,删除请求的索引/列级别。
  • Series.drop_duplicates([keep, inplace]) 返回系列,删除重复值。
  • Series.duplicated([keep]) 指示重复的系列值。
  • Series.equals(other) 测试两个对象是否包含相同的元素。
  • Series.first(offset) 基于日期偏移量对初始时间序列数据的子集进行子集化的便捷方法。
  • Series.head([n]) 返回前n行。
  • Series.idxmax([axis, skipna]) 返回最大值的行标签。
  • Series.idxmin([axis, skipna]) 返回最小值的行标签。
  • Series.isin(values) 检查series中是否包含值。
  • Series.last(offset) 基于日期偏移量化时间序列数据的最终时段的便捷方法。
  • Series.reindex([index]) 使用可选填充逻辑将系列符合到新索引,将NA/NaN放置在先前索引中没有值的位置。
  • Series.reindex_like(other[, method, copy, …]) 返回具有匹配索引的对象作为其他对象。
  • Series.rename([index]) 更改series索引标签或名称。
  • Series.rename_axis([mapper, index, columns, …]) 设置索引或列的轴名称。
  • Series.reset_index([level, drop, name, inplace]) 使用索引重置生成新的DataFrame或Series。
  • Series.sample([n, frac, replace, weights, …]) 从对象轴返回随机的项目样本。
  • Series.select(crit[, axis]) (DEPRECATED)返回与轴标签匹配条件对应的数据。
  • Series.set_axis(labels[, axis, inplace]) 将所需索引分配给给定轴。
  • Series.take(indices[, axis, convert, is_copy]) 沿轴返回给定位置索引中的元素。
  • Series.tail([n]) 返回最后n行。
  • Series.truncate([before, after, axis, copy]) 在某个索引值之前和之后截断一个Series或DataFrame。
  • Series.where(cond[, other, inplace, axis, …]) 替换条件为False的值。
  • Series.mask(cond[, other, inplace, axis, …]) 替换条件为True的值。
  • Series.add_prefix(prefix) 带有字符串前缀的前缀标签。
  • Series.add_suffix(suffix) 带有字符串后缀的后缀标签。
  • Series.filter([items, like, regex, axis]) 根据指定索引中的标签设置数据框的行或列。

 

9.缺少数据处理

  • Series.isna() 检测缺失值。
  • Series.notna() 检测现有(非缺失)值。
  • Series.dropna([axis, inplace]) 返回删除了缺失值的新Series。
  • Series.fillna([value, method, axis, …]) 使用指定的方法填充NA / NaN值。
  • Series.interpolate([method, axis, limit, …]) 根据不同的方法插值。

 

10.重塑,排序

  • Series.argsort([axis, kind, order]) 覆盖ndarray.argsort。
  • Series.argmin([axis, skipna]) (DEPRECATED)返回最小值的行标签。
  • Series.argmax([axis, skipna]) (DEPRECATED)返回最大值的行标签。
  • Series.reorder_levels(order) 使用输入顺序重新排列索引级别。
  • Series.sort_values([axis, ascending, …]) 按值排序。
  • Series.sort_index([axis, level, ascending, …]) 按索引标签排序系列。
  • Series.swaplevel([i, j, copy]) 在MultiIndex中交换i和j级别。
  • Series.unstack([level, fill_value]) Unstack,又名
  • Series.searchsorted(value[, side, sorter]) 查找应插入元素以维护顺序的索引。
  • Series.ravel([order]) 将展平的底层数据作为ndarray返回。
  • Series.repeat(repeats[, axis]) 重复系列的元素。
  • Series.squeeze([axis]) 将1维轴对象压缩为标量。
  • Series.view([dtype]) 创建系列的新视图。

 

11.合并/加入/合并

  • Series.append(to_append [,ignore_index,...]) 连接两个或更多系列。
  • Series.replace([to_replace,value,inplace,...]) 替换给定的值to_replace与价值。
  • Series.update(other) 使用传递的Series中的非NA值修改系列。

 

12.时间序列相关

  • Series.asfreq(freq[, method, how, …]) 将TimeSeries转换为指定的频率。
  • Series.asof(where[, subset]) 返回前最后一行(S)没有任何NaN的地方。
  • Series.shift([periods, freq, axis, fill_value]) 使用可选的时间频率按期望的周期数移动索引。
  • Series.first_valid_index() 返回第一个非NA / null值的索引。
  • Series.last_valid_index() 返回最后一个非NA / null值的索引。
  • Series.resample(rule[, how, axis, …]) 重新采样时间序列数据。
  • Series.tz_convert(tz[, axis, level, copy]) 将tz感知轴转换为目标时区。
  • Series.tz_localize(tz[, axis, level, copy, …]) 将Series或DataFrame的tz-naive索引本地化为目标时区
  • Series.at_time(time[, asof, axis]) 在特定时间选择值(例如,
  • Series.between_time(start_time, end_time[, …]) 选择一天中特定时间之间的值(例如,上午9:00-9:30)。
  • Series.tshift([periods, freq, axis]) 使用索引的频率(如果可用)移动时间索引。
  • Series.slice_shift([periods, axis]) 相当于移位而不复制数据。

 

13.访问者

  • Pandas在各种访问器下提供特定于dtype的方法。这些是单独的命名空间Series,仅适用于特定的数据类型。
  • 数据类型 访问
  • Data Type Accessor
  • Datetime,Timedelta,Period dt
  • String str
  • Categorical cat
  • Sparse sparse

 

14.日期时间属性

  • Series.dt.date 返回python datetime.date对象的numpy数组(即没有时区信息的Timestamps的日期部分)。
  • Series.dt.time 返回datetime.time的numpy数组。
  • Series.dt.timetz 返回包含时区信息的numpy数组datetime.time。
  • Series.dt.year 日期时间。
  • Series.dt.month 月份为1月= 1,12月= 12。
  • Series.dt.day 日期时间。
  • Series.dt.hour 日期时间。
  • Series.dt.minute 日期时间的分钟。
  • Series.dt.second 日期时间的秒数。
  • Series.dt.microsecond 日期时间的微秒。
  • Series.dt.nanosecond 日期时间的纳秒。
  • Series.dt.week 一年中的一周序数。
  • Series.dt.weekofyear 一年中的一周序数。
  • Series.dt.dayofweek 星期一= 0,星期日= 6的星期几。
  • Series.dt.weekday 星期一= 0,星期日= 6的星期几。
  • Series.dt.dayofyear 一年中的序数日。
  • Series.dt.quarter 四分之一的日期。
  • Series.dt.is_month_start 指示日期是否是该月的第一天。
  • Series.dt.is_month_end 指示日期是否是该月的最后一天。
  • Series.dt.is_quarter_start 指示日期是否是一个季度的第一天。
  • Series.dt.is_quarter_end 指示日期是否是一个季度的最后一天。
  • Series.dt.is_year_start 指明日期是否是一年的第一天。
  • Series.dt.is_year_end 指明日期是否是一年中的最后一天。
  • Series.dt.is_leap_year 布尔指示符,如果日期属于闰年。
  • Series.dt.daysinmonth 这个月的天数。
  • Series.dt.days_in_month 这个月的天数。
  • Series.dt.tz 返回时区,如果有的话。
  • Series.dt.freq

日期时间方法

  • Series.dt.to_period(*args, **kwargs) 以特定频率转换为PeriodArray / Index。
  • Series.dt.to_pydatetime() 将数据作为本机Python日期时间对象的数组返回。
  • Series.dt.tz_localize(*args, **kwargs) 将tz-naive日期时间数组/索引本地化为tz感知日期时间数
  • Series.dt.tz_convert(*args, **kwargs) 将tz感知日期时间数组/索引从一个时区转换为另一个时区。
  • Series.dt.normalize(*args, **kwargs) 将时间转换为午夜。
  • Series.dt.strftime(*args, **kwargs) 使用指定的date_format转换为Index。
  • Series.dt.round(*args, **kwargs) 对数据执行循环操作到指定的频率。
  • Series.dt.floor(*args, **kwargs) 对指定频率的数据执行floor操作。
  • Series.dt.ceil(*args, **kwargs) 对数据执行ceil操作到指定的频率。
  • Series.dt.month_name(*args, **kwargs) 返回具有指定语言环境的DateTimeIndex的月份名称。
  • Series.dt.day_name(*args, **kwargs) 返回具有指定语言环境的DateTimeIndex的日期名称。

期间属性

  • Series.dt.qyear
  • Series.dt.start_time
  • Series.dt.end_time

Timedelta属性

  • Series.dt.days 每个元素的天数。
  • Series.dt.seconds 每个元素的秒数(> = 0且小于1天)。
  • Series.dt.microseconds 每个元素的微秒数(> = 0且小于1秒)。
  • Series.dt.nanoseconds 每个元素的纳秒数(> = 0且小于1微秒)。
  • Series.dt.components 返回Timedeltas组件的Dataframe。

Timedelta方法

  • Series.dt.to_pytimedelta() 返回本机datetime.timedelta对象的数组。
  • Series.dt.total_seconds(* args,** kwargs) 返回每个元素的总持续时间,以秒为单位。

 

15.分类访问者

  • Series.cat 访问者可以使用Categorical-dtype特定的方法和属性。
  • Series.cat.categories 这种分类的类别。
  • Series.cat.ordered 类别是否具有有序关系。
  • Series.cat.codes 返回代码系列以及索引。
  • Series.cat.rename_categories(* args,** kwargs) 重命名类别。
  • Series.cat.reorder_categories(* args,** kwargs) 重新排序new_categories中指定的类别。
  • Series.cat.add_categories(* args,** kwargs) 添加新类别。
  • Series.cat.remove_categories(* args,** kwargs) 删除指定的类别。
  • Series.cat.remove_unused_categories(* args,......) 删除未使用的类别。
  • Series.cat.set_categories(* args,** kwargs) 将类别设置为指定的new_categories。
  • Series.cat.as_ordered(* args,** kwargs) 设置要订购的分类。
  • Series.cat.as_unordered(* args,** kwargs) 将Categorical设置为无序。

 

16.字符串处理

  • Series.str.capitalize() 将Series / Index中的字符串转换为大写。
  • Series.str.cat([others, sep, na_rep, join]) 使用给定的分隔符连接Series / Index中的字符串。
  • Series.str.center(width[, fillchar]) 使用附加字符填充系列/索引中字符串的左侧和右侧。
  • Series.str.contains(pat[, case, flags, na, …]) 测试pattern或regex是否包含在Series或Index的字符串中。
  • Series.str.count(pat[, flags]) 计算系列/索引的每个字符串中模式的出现次数。
  • Series.str.decode(encoding[, errors]) 使用指定的编码解码系列/索引中的字符串。
  • Series.str.encode(encoding[, errors]) 使用指定的编码对系列/索引中的字符串进行编码。
  • Series.str.endswith(pat[, na]) 测试每个字符串元素的结尾是否与模式匹配。
  • Series.str.extract(pat[, flags, expand]) 提取的正则表达式捕获组拍作为一个数据帧列。
  • Series.str.extractall(pat[, flags]) 对于系列中的每个主题字符串,从正则表达式pat的所有匹配中提取组。
  • Series.str.find(sub[, start, end]) 返回Series / Index中每个字符串中的最低索引,其中子字符串完全包含在[start:end]之间。
  • Series.str.findall(pat[, flags]) 在系列/索引中查找所有出现的模式或正则表达式。
  • Series.str.get(i) 从指定位置的每个组件中提取元素。
  • Series.str.index(sub[, start, end]) 返回子字符串完全包含在[start:end]之间的每个字符串中的最低索引。
  • Series.str.join(sep) 使用传递的分隔符连接包含在Series / Index中的元素的列表。
  • Series.str.len() 计算Series / Index中每个元素的长度。
  • Series.str.ljust(width[, fillchar]) 使用附加字符填充系列/索引中字符串的右侧。
  • Series.str.lower() 将Series / Index中的字符串转换为小写。
  • Series.str.lstrip([to_strip]) 删除前导和尾随字符。
  • Series.str.match(pat[, case, flags, na]) 确定每个字符串是否与正则表达式匹配。
  • Series.str.normalize(form) 返回Series / Index中字符串的Unicode普通表单。
  • Series.str.pad(width[, side, fillchar]) 将系列/索引中的字符串填充到宽度。
  • Series.str.partition([sep, expand]) 在第一次出现sep时拆分字符串。
  • Series.str.repeat(repeats) 复制系列或索引中的每个字符串。
  • Series.str.replace(pat, repl[, n, case, …]) 用一些其他字符串替换Series / Index中出现的pattern / regex。
  • Series.str.rfind(sub[, start, end]) 返回Series / Index中每个字符串中的最高索引,其中子字符串完全包含在[start:end]之间。
  • Series.str.rindex(sub[, start, end]) 返回每个字符串中的最高索引,其中子字符串完全包含在[start:end]之间。
  • Series.str.rjust(width[, fillchar]) 使用附加字符填充系列/索引中字符串的左侧。
  • Series.str.rpartition([sep, expand]) 在最后一次出现的sep时拆分字符串。
  • Series.str.rstrip([to_strip]) 删除前导和尾随字符。
  • Series.str.slice([start, stop, step]) 从系列或索引中的每个元素切片子串。
  • Series.str.slice_replace([start, stop, repl]) 用另一个值替换字符串的位置切片。
  • Series.str.split([pat, n, expand]) 在给定的分隔符/分隔符周围拆分字符串。
  • Series.str.rsplit([pat, n, expand]) 在给定的分隔符/分隔符周围拆分字符串。
  • Series.str.startswith(pat[, na]) 测试每个字符串元素的开头是否与模式匹配。
  • Series.str.strip([to_strip]) 删除前导和尾随字符。
  • Series.str.swapcase() 将Series / Index中的字符串转换为swapcased。
  • Series.str.title() 将系列/索引中的字符串转换为标题。
  • Series.str.translate(table[, deletechars]) 通过给定的映射表映射字符串中的所有字符。
  • Series.str.upper() 将Series / Index中的字符串转换为大写。
  • Series.str.wrap(width, **kwargs) 将Series / Index中的长字符串换行,以长度小于给定宽度的段落进行格式化。
  • Series.str.zfill(width) 系列/索引中的字符串填充前缀为'0'字符。
  • Series.str.isalnum() 检查每个字符串中的所有字符是否为字母数字。
  • Series.str.isalpha() 检查每个字符串中的所有字符是否都是字母。
  • Series.str.isdigit() 检查每个字符串中的所有字符是否为数字。
  • Series.str.isspace() 检查每个字符串中的所有字符是否为空格。
  • Series.str.islower() 检查每个字符串中的所有字符是否都是小写。
  • Series.str.isupper() 检查每个字符串中的所有字符是否都是大写。
  • Series.str.istitle() 检查每个字符串中的所有字符是否都是标题。
  • Series.str.isnumeric() 检查每个字符串中的所有字符是否都是数字。
  • Series.str.isdecimal() 检查每个字符串中的所有字符是否为十进制。
  • Series.str.get_dummies([sep]) 用sep拆分Series中的每个字符串,并返回一个虚拟/指示变量框。

 

17.稀疏访问器

  • Series.sparse.npoints 非fill_value点数。
  • Series.sparse.density 非fill_value点的百分比,以十进制表示。
  • Series.sparse.fill_value 不存储fill_value 数据中的元素。
  • Series.sparse.sp_values 包含非fill_value值的ndarray 。
  • Series.sparse.from_coo(A [,dense_index]) 从scipy.sparse.coo_matrix创建SparseSeries。
  • Series.sparse.to_coo([row_levels,...]) 使用MultiIndex从SparseSeries创建scipy.sparse.coo_matrix。

 

18.绘图

  • Series.plot([kind, ax, figsize, ….]) 系列绘图访问器和方法
  • Series.plot.area(** kwds) 区域情节。
  • Series.plot.bar(** kwds) 垂直条形图。
  • Series.plot.barh(** kwds) 单杠图。
  • Series.plot.box(** kwds) 箱形图。
  • Series.plot.density([bw_method,ind]) 使用高斯核生成核密度估计图。
  • Series.plot.hist([bins]) 直方图。
  • Series.plot.kde([bw_method,ind]) 使用高斯核生成核密度估计图。
  • Series.plot.line(** kwds) 线图。
  • Series.plot.pie(** kwds) 饼形图。
  • Series.hist([by,ax,grid,xlabelsize,...]) 使用matplotlib绘制输入序列的直方图。

 

19.序列化/ IO /转换

  • Series.to_pickle(path[, compression, protocol]) Pickle(序列化)对象到文件。
  • Series.to_csv(*args, **kwargs) 将对象写入逗号分隔值(csv)文件。
  • Series.to_dict([into]) 将Series转换为{label - > value} dict或类似dict的对象。
  • Series.to_excel(excel_writer[, sheet_name, …]) 将对象写入Excel工作表。
  • Series.to_frame([name]) 将Series转换为DataFrame。
  • Series.to_xarray() 从pandas对象返回一个xarray对象。
  • Series.to_hdf(path_or_buf, key, **kwargs) 使用HDFStore将包含的数据写入HDF5文件。
  • Series.to_sql(name, con[, schema, …]) 将存储在DataFrame中的记录写入SQL数据库。
  • Series.to_msgpack([path_or_buf, encoding]) 使用msgpack格式将对象序列化为输入文件路径。
  • Series.to_json([path_or_buf, orient, …]) 将对象转换为JSON字符串。
  • Series.to_sparse([kind, fill_value]) 将Series转换为SparseSeries。
  • Series.to_dense() 返回NDFrame的密集表示(与稀疏相反)。
  • Series.to_string([buf, na_rep, …]) 渲染Series的字符串表示形式。
  • Series.to_clipboard([excel, sep]) 将对象复制到系统剪贴板。
  • Series.to_latex([buf, columns, col_space, …]) 将对象渲染到LaTeX表格环境表。
  •  

20.稀疏

  • SparseSeries.to_coo([row_levels,...]) 使用MultiIndex从SparseSeries创建scipy.sparse.coo_matrix。
  • SparseSeries.from_coo(A [,dense_index]) 从scipy.sparse.coo_matrix创建SparseSeries。

 

 

 

 类似资料: