maxframe.dataframe.DataFrame#

class maxframe.dataframe.DataFrame(data=None, index=None, columns=None, dtype=None, copy=False, chunk_size=None, gpu=None, sparse=None, num_partitions=None, dtype_backend=None)[源代码]#
__init__(data=None, index=None, columns=None, dtype=None, copy=False, chunk_size=None, gpu=None, sparse=None, num_partitions=None, dtype_backend=None)[源代码]#

方法

__init__([data, index, columns, dtype, ...])

abs()

add(other[, axis, level, fill_value])

获取 DataFrame 和 other 的加法,按元素计算(二元运算符 add)。

add_prefix(prefix)

使用字符串 prefix 作为标签前缀。

add_suffix(suffix)

使用字符串 suffix 作为标签后缀。

agg([func, axis])

在指定轴上使用一个或多个操作进行聚合。

aggregate([func, axis])

在指定轴上使用一个或多个操作进行聚合。

align(other[, join, axis, level, copy, ...])

使用指定的连接方法在轴上对齐两个对象。

all([axis, bool_only, skipna, level, method])

any([axis, bool_only, skipna, level, method])

append(other[, ignore_index, ...])

other 的行追加到调用者的末尾,返回一个新对象。

apply(func[, axis, raw, result_type, args, ...])

沿 DataFrame 的轴应用函数。

applymap(func[, na_action, dtypes, dtype, ...])

对 DataFrame 的每个元素应用函数。

around([decimals])

将 DataFrame 四舍五入到可变的小数位数。

assign(**kwargs)

为 DataFrame 分配新列。

astype(dtype[, copy, errors])

将 pandas 对象转换为指定的 dtype。

at_time(time[, axis])

选择一天中特定时间的值(例如,上午9:30)。

backfill([axis, inplace, limit, downcast])

DataFrame.fillna() 使用 method='bfill' 的同义词。

between_time(start_time, end_time[, ...])

选择一天中特定时间之间的值(例如,上午9:00-9:30)。

bfill([axis, inplace, limit, downcast])

DataFrame.fillna() 使用 method='bfill' 的同义词。

clip([lower, upper, axis, inplace])

在输入阈值处修剪值。

combine(other, func[, fill_value, overwrite])

与另一个 DataFrame 执行按列组合。

combine_first(other)

使用 other 中相同位置的值更新空元素。

compare(other[, align_axis, keep_shape, ...])

与另一个 DataFrame 比较并显示差异。

convert_dtypes([infer_objects, ...])

使用支持 pd.NA 的数据类型将列转换为最佳的可能数据类型。

copy()

copy_from(obj)

copy_to(target)

corr([method, min_periods])

计算列之间的成对相关性,排除 NA/null 值。

corrwith(other[, axis, drop, method])

计算成对相关性。

count([axis, level, numeric_only])

cov([min_periods, ddof, numeric_only])

计算列之间的成对协方差,排除 NA/null 值。

cummax([axis, skipna])

cummin([axis, skipna])

cumprod([axis, skipna])

cumsum([axis, skipna])

describe([percentiles, include, exclude])

生成描述性统计信息。

diff([periods, axis])

元素的一阶离散差分。

div(other[, axis, level, fill_value])

获取 DataFrame 和 other 的浮点除法,按元素计算(二元运算符 truediv)。

dot(other)

计算 DataFrame 和 other 之间的矩阵乘法。

drop([labels, axis, index, columns, level, ...])

从行或列中删除指定的标签。

drop_duplicates([subset, keep, inplace, ...])

返回删除了重复行的 DataFrame。

droplevel(level[, axis])

返回删除了请求的索引/列级别的 Series/DataFrame。

dropna([axis, how, thresh, subset, inplace, ...])

删除缺失值。

duplicated([subset, keep, method])

返回表示重复行的布尔 Series。

eq(other[, axis, level, fill_value])

获取 DataFrame 和 other 的等于比较,按元素计算(二元运算符 eq)。

eval(expr[, inplace])

评估描述 DataFrame 列操作的字符串。

ewm([com, span, halflife, alpha, ...])

提供指数加权函数。

execute([session])

expanding([min_periods, shift, reverse_range])

提供扩展变换。

explode(column[, ignore_index, ...])

将类列表的每个元素转换为一行,复制索引值。

ffill([axis, inplace, limit, downcast])

DataFrame.fillna() 使用 [method='ffill'] 的同义词。

fillna([value, method, axis, inplace, ...])

使用指定方法填充 NA/NaN 值。

filter([items, like, regex, axis])

根据指定的索引标签对 DataFrame 的行或列进行子集选择。

first_valid_index()

返回第一个非 NA 值的索引,如果未找到非 NA 值则返回 None。

floordiv(other[, axis, level, fill_value])

获取 DataFrame 和 other 的整数除法,按元素计算(二元运算符 floordiv)。

from_dict(data[, orient, dtype, columns])

从数组类或字典的字典构造 DataFrame。

from_records(data[, index, exclude, ...])

将结构化或记录型 ndarray 转换为 DataFrame。

from_tensor(tensor[, index, columns, gpu, ...])

ge(other[, axis, level, fill_value])

获取 DataFrame 和 other 的大于等于比较,按元素计算(二元运算符 ge)。

groupby([by, level, as_index, sort, ...])

使用映射器或 Series 列对 DataFrame 进行分组。

gt(other[, axis, level, fill_value])

获取 DataFrame 和 other 的大于比较,按元素计算(二元运算符 gt)。

head([n])

返回前 n 行。

idxmax([axis, skipna])

返回在请求轴上首次出现最大值的索引。

idxmin([axis, skipna])

返回在请求轴上首次出现最小值的索引。

infer_objects([copy])

尝试为对象列推断更好的数据类型。

insert(loc, column, value[, allow_duplicates])

在指定位置将列插入 DataFrame。

isin(values)

DataFrame 中的每个元素是否包含在值中。

isna()

检测缺失值。

isnull()

检测缺失值。

iterrows([batch_size, session])

将 DataFrame 行作为 (index, Series) 对进行迭代。

itertuples([index, name, batch_size, session])

将 DataFrame 行作为 namedtuples 进行迭代。

join(other[, on, how, lsuffix, rsuffix, ...])

连接另一个 DataFrame 的列。

keys()

获取 'info axis'(更多信息请参见索引部分)。

kurt([axis, skipna, level, numeric_only, ...])

kurtosis([axis, skipna, level, ...])

last_valid_index()

返回最后一个非 NA 值的索引,如果未找到非 NA 值则返回 None。

le(other[, axis, level, fill_value])

获取 DataFrame 和 other 的小于等于比较,按元素计算(二元运算符 le)。

lt(other[, axis, level, fill_value])

获取 DataFrame 和 other 的小于比较,按元素计算(二元运算符 lt)。

map(func[, na_action, dtypes, dtype, skip_infer])

对 DataFrame 的每个元素应用函数。

mask(cond[, other, inplace, axis, level, ...])

替换条件为 True 的值。

max([axis, skipna, level, numeric_only, method])

mean([axis, skipna, level, numeric_only, method])

median([axis, skipna, level, numeric_only, ...])

melt([id_vars, value_vars, var_name, ...])

将 DataFrame 从宽格式转换为长格式,可选择保留标识符集。

memory_usage([index, deep])

返回每列的内存使用量(以字节为单位)。

merge(right[, how, on, left_on, right_on, ...])

使用数据库风格的连接合并 DataFrame 或命名的 Series 对象。

min([axis, skipna, level, numeric_only, method])

mod(other[, axis, level, fill_value])

获取 DataFrame 和 other 的模运算,按元素计算(二元运算符 mod)。

mode([axis, numeric_only, dropna, combine_size])

获取沿选定轴的每个元素的众数。

mul(other[, axis, level, fill_value])

获取 DataFrame 和 other 的乘法,按元素计算(二元运算符 mul)。

multiply(other[, axis, level, fill_value])

获取 DataFrame 和 other 的乘法,按元素计算(二元运算符 mul)。

ne(other[, axis, level, fill_value])

获取 DataFrame 和 other 的不等于比较,按元素计算(二元运算符 ne)。

nlargest(n, columns[, keep])

返回按 columns 降序排列的前 n 行。

notna()

检测存在的(非缺失)值。

notnull()

检测存在的(非缺失)值。

nsmallest(n, columns[, keep])

返回按 columns 升序排列的前 n 行。

nunique([axis, dropna])

计算请求轴上的不同观测值数量。

pad([axis, inplace, limit, downcast])

DataFrame.fillna() 使用 [method='ffill'] 的同义词。

pct_change([periods, fill_method, limit, freq])

当前元素与前一个元素之间的百分比变化。

pivot(columns[, index, values])

返回按给定索引/列值组织的重塑 DataFrame。

pivot_table([values, index, columns, ...])

创建一个电子表格风格的数据透视表作为 DataFrame。

pop(item)

返回项目并从框架中删除。

pow(other[, axis, level, fill_value])

获取 DataFrame 和 other 的指数幂,按元素计算(二元运算符 pow)。

prod([axis, skipna, level, min_count, ...])

product([axis, skipna, level, min_count, ...])

quantile([q, axis, numeric_only, interpolation])

返回在请求轴上给定分位数的值。

query(expr[, inplace])

使用布尔表达式查询 DataFrame 的列。

radd(other[, axis, level, fill_value])

获取 DataFrame 和 other 的加法,按元素计算(二元运算符 radd)。

rank([axis, method, numeric_only, ...])

沿轴计算数值数据的排名(从1到n)。

rdiv(other[, axis, level, fill_value])

获取 DataFrame 和 other 的浮点除法,按元素计算(二元运算符 rtruediv)。

rechunk(chunk_size[, reassign_worker])

重新划分 DataFrame、Series 或 Index 数据的分片。

reindex([labels, index, columns, axis, ...])

使 Series/DataFrame 符合带有可选填充逻辑的新索引。

reindex_like(other[, method, copy, limit, ...])

返回一个与另一个对象具有匹配索引的对象。

rename([mapper, index, columns, axis, copy, ...])

更改轴标签。

rename_axis([mapper, index, columns, axis, ...])

为索引或列设置轴的名称。

reorder_levels(order[, axis])

使用输入顺序重新排列索引级别。

replace([to_replace, value, inplace, limit, ...])

to_replace 中给出的值替换为 value

reset_index([level, drop, inplace, ...])

重置索引,或其一个级别。

rfloordiv(other[, axis, level, fill_value])

获取 DataFrame 和 other 的整数除法,按元素计算(二元运算符 rfloordiv)。

rmod(other[, axis, level, fill_value])

获取 DataFrame 和 other 的模运算,按元素计算(二元运算符 rmod)。

rmul(other[, axis, level, fill_value])

获取 DataFrame 和 other 的乘法,按元素计算(二元运算符 rmul)。

rolling(window[, min_periods, center, ...])

提供滚动窗口计算。

round([decimals])

将 DataFrame 四舍五入到可变的小数位数。

rpow(other[, axis, level, fill_value])

获取 DataFrame 和 other 的指数幂,按元素计算(二元运算符 rpow)。

rsub(other[, axis, level, fill_value])

获取 DataFrame 和 other 的减法,按元素计算(二元运算符 rsubtract)。

rtruediv(other[, axis, level, fill_value])

获取 DataFrame 和 other 的浮点除法,按元素计算(二元运算符 rtruediv)。

sample([n, frac, replace, weights, ...])

从对象的轴返回随机样本项。

select_dtypes([include, exclude])

基于列的数据类型返回 DataFrame 列的子集。

sem([axis, skipna, level, ddof, ...])

set_axis(labels[, axis, inplace])

将所需索引分配给给定轴。

set_index(keys[, drop, append, inplace, ...])

使用现有列设置 DataFrame 索引。

shift([periods, freq, axis, fill_value])

通过所需的周期数移动索引,并可选择时间 freq

skew([axis, skipna, level, numeric_only, ...])

sort_index([axis, level, ascending, ...])

按标签(沿轴)对对象进行排序。

sort_values(by[, axis, ascending, inplace, ...])

沿任一轴按值排序。

stack([level, dropna])

将指定级别从列堆叠到索引。

std([axis, skipna, level, ddof, ...])

sub(other[, axis, level, fill_value])

获取 DataFrame 和 other 的减法,按元素计算(二元运算符 subtract)。

sum([axis, skipna, level, min_count, ...])

swaplevel([i, j, axis])

MultiIndex 中交换级别 i 和 j。

tail([n])

返回最后 n 行。

take(indices[, axis])

返回沿轴的给定*位置*索引中的元素。

to_clipboard(*[, excel, sep, batch_size, ...])

将对象复制到系统剪贴板。

to_csv(path[, sep, na_rep, float_format, ...])

将对象写入逗号分隔值 (csv) 文件。

to_dict([orient, into, index, batch_size, ...])

将 DataFrame 转换为 Python dict

to_json([path, orient, date_format, ...])

将对象转换为 JSON 字符串

to_lance(path[, mode, index, index_label, ...])

Write a DataFrame to a Lance dataset.

to_odps_table(table[, partition, ...])

将 DataFrame 对象写入 MaxCompute (ODPS) 表。

to_pandas([session])

to_parquet(path[, engine, compression, ...])

将 DataFrame 以二进制 parquet 格式写入,每个数据块将被写入一个 Parquet 文件。

to_tensor()

transform(func[, axis, dtypes, skip_infer])

在 self 上调用 func 产生一个具有转换值的 DataFrame。

transpose()

转置索引和列。

truediv(other[, axis, level, fill_value])

获取 DataFrame 和 other 的浮点除法,按元素计算(二元运算符 truediv)。

truncate([before, after, axis, copy])

在某个索引值之前和之后截断 Series 或 DataFrame。

tshift([periods, freq, axis])

移动时间索引,如果可用则使用索引的频率。

unstack([level, fill_value])

取消堆叠,也称为数据透视,将具有 MultiIndex 的 Series 转换为 DataFrame。

update(other[, join, overwrite, ...])

使用来自另一个 DataFrame 的非 NA 值就地修改。

value_counts([subset, normalize, sort, ...])

var([axis, skipna, level, ddof, ...])

where(cond[, other, inplace, axis, level, ...])

替换条件为 False 的值。

xs(key[, axis, level, drop_level])

从 Series/DataFrame 返回横截面。

属性

T

at

访问行/列标签对的单个值。

columns

data

dtypes

返回 DataFrame 中的数据类型。

iat

通过整数位置访问行/列对的单个值。

iloc

基于纯整数位置的索引,用于按位置选择。

index

loc

通过标签或布尔数组访问一组行和列。

ndim

返回一个表示轴数/数组维度的整数。

shape

size

type_name

values