数据帧
构造函数
DataFrame([数据,索引,列,dtype,副本]) 具有标注轴(行和列)的二维大小可变的,可能是异构的表格数据结构。
属性和底层数据
轴数
DataFrame.index DataFrame的索引(行标签)。
DataFrame.columns DataFrame的列标签。
DataFrame.dtypes 返回DataFrame中的dtype。
DataFrame.ftypes (不推荐使用)返回DataFrame中的ftypes(指示稀疏/密集和dtype)。
DataFrame.get_dtype_counts(self) (不推荐使用)返回此对象中唯一dtypes的计数。
DataFrame.get_ftype_counts(self) (不推荐使用)返回此对象中唯一ftypes的计数。
DataFrame.select_dtypes(self[,包括,排除]) 根据列dtypes返回DataFrame列的子集。
DataFrame.values 返回DataFrame的Numpy表示形式。
DataFrame.get_values(self) (不推荐使用)将稀疏值转换为稠密后返回ndarray。
DataFrame.axes 返回一个表示DataFrame轴的列表。
DataFrame.ndim 返回一个表示轴数/数组维数的整数。
DataFrame.size 返回一个int表示此对象中元素的数量。
DataFrame.shape 返回一个表示DataFrame维数的元组。
DataFrame.memory_usage(self [,index,deep]) 返回每列的内存使用情况(以字节为单位)。
DataFrame.empty 指示DataFrame是否为空。
DataFrame.is_copy 返回副本。
转换
DataFrame.astype(self,dtype [,复制,错误]) 将pandas对象转换为指定的dtype dtype。
DataFrame.infer_objects(self) 尝试为对象列推断更好的dtype。
DataFrame.copy(self[,深层]) 复制该对象的索引和数据。
DataFrame.isna(self) 检测缺失值。
DataFrame.notna(self) 检测现有(非缺失)值。
DataFrame.bool(self) 返回单个元素PandasObject的布尔值。
索引,迭代
DataFrame.head(self[,n]) 返回前n行。默认n=5
DataFrame.at 访问行/列标签对的单个值。
DataFrame.iat 通过整数位置访问行/列对的单个值。
DataFrame.loc 通过标签或布尔数组访问一组行和列。
DataFrame.iloc 基于位置的纯基于整数位置的索引。
DataFrame.insert(self,位置,列,值[,…]) 将列插入到DataFrame中的指定位置。
DataFrame.__iter__(self) 遍历信息轴。
DataFrame.items(self) 迭代器(列名,系列)对。
DataFrame.iteritems(self) 迭代器(列名,系列)对。
DataFrame.keys(self) 获取“信息轴”(有关更多信息,请参见索引)
DataFrame.iterrows(self) 将DataFrame行作为(索引,系列)对进行迭代。
DataFrame.itertuples(self[,索引,名称]) 以namedtuple的形式遍历DataFrame行。
DataFrame.lookup(self,row_labels,col_labels) DataFrame基于标签的“花式索引”功能。
DataFrame.pop(个体,物品) 返回项目并从框架中放下。
DataFrame.tail(self[,n]) 返回最后n行。默认n=5
DataFrame.xs(self,键[,轴,水平,…]) 从Series / DataFrame返回横截面。
DataFrame.get(self,键[,默认]) 从对象获取给定键的项目(例如:DataFrame列)。
DataFrame.isin(self,价值观) DataFrame中的每个元素是否包含在值中。
DataFrame.where(self,cond [,其他,…]) 替换条件为False的值。
DataFrame.mask(self,cond [,其他,就位,…]) 替换条件为True的值。
DataFrame.query(self,expr [,就位]) 使用布尔表达式查询DataFrame的列。
有关更多信息.at,.iat,.loc,和 .iloc,看到索引文件。
二元运算功能
DataFrame.add(self,other [,轴,水平,…]) 获取数据帧和其他元素的加法(二进制运算符add)。
DataFrame.sub(self,other [,轴,水平,…]) 获取数据帧和其他元素的减法(二进制运算符sub)。
DataFrame.mul(self,other [,轴,水平,…]) 获取数据帧和其他逐元素的乘法(二进制运算符mul)。
DataFrame.div(self,other [,轴,水平,…]) 获取数据框和其他元素的浮动划分(二进制运算符truediv)。
DataFrame.truediv(self,other [,轴,...]) 获取数据框和其他元素的浮动划分(二进制运算符truediv)。
DataFrame.floordiv(self,other [,轴,...]) 获取数据帧和其他按元素的整数分割(二进制运算符floordiv)。
DataFrame.mod(self,other [,轴,水平,…]) 获取数据帧的模数和其他逐元素的模数(二进制运算符mod)。
DataFrame.pow(self,other [,轴,水平,…]) 获取数据帧和其他逐元素的指数幂(二进制运算符pow)。
DataFrame.dot(self) 计算DataFrame与其他框架之间的矩阵乘法。
DataFrame.radd(self,other [,轴,水平,…]) 获取数据帧和其他元素的加法(二进制运算符radd)。
DataFrame.rsub(self,other [,轴,水平,…]) 获取数据帧的减法和其他逐元素(二进制运算符rsub)。
DataFrame.rmul(self,other [,轴,水平,…]) 获取数据帧和其他逐元素的乘法(二进制运算符rmul)。
DataFrame.rdiv(self,other [,轴,水平,…]) 获取数据帧和其他逐元素的浮点除法(二进制运算符rtruediv)。
DataFrame.rtruediv(self,other [,轴,...]) 获取数据帧和其他逐元素的浮点除法(二进制运算符rtruediv)。
D