dask_expr._collection.DataFrame
dask_expr._collection.DataFrame¶
- class dask_expr._collection.DataFrame(expr)[源代码]¶
类似 DataFrame 的表达式集合。
构造函数接受表示查询的表达式作为输入。该类不旨在直接实例化。相反,请使用 Dask 中的一个 IO 连接器。
- __init__(expr)¶
方法
__init__(expr)abs()返回一个包含每个元素绝对数值的 Series/DataFrame。
add(other[, axis, level, fill_value])add_prefix(prefix)使用字符串 prefix 作为标签前缀。
add_suffix(suffix)使用字符串 suffix 作为后缀标签。
align(other[, join, axis, fill_value])使用指定的连接方法将两个对象沿其轴对齐。
all([axis, skipna, split_every])返回是否所有元素都为 True,可能是在某个轴上。
analyze([filename, format])输出表达式中每个节点的统计信息。
any([axis, skipna, split_every])返回是否任何元素为 True,可能在某个轴上。
apply(function, *args[, meta, axis])pandas.DataFrame.apply 的并行版本
assign(**pairs)将新列分配给 DataFrame。
astype(dtypes)将 pandas 对象转换为指定的数据类型
dtype。bfill([axis, limit])使用下一个有效观测值来填充NA/NaN值。
categorize([columns, index, split_every])将 DataFrame 的列转换为类别数据类型。
clear_divisions()忘记分割信息。
clip([lower, upper, axis])在输入阈值处修剪值。
combine(other, func[, fill_value, overwrite])与另一个 DataFrame 进行列合并。
combine_first(other)使用 other 中相同位置的值更新空元素。
compute([fuse, concatenate])计算这个 DataFrame。
compute_current_divisions([col, set_divisions])计算DataFrame的当前分区。
copy([deep])复制数据框
corr([method, min_periods, numeric_only, ...])计算列之间的成对相关性,排除NA/null值。
count([axis, numeric_only, split_every])计算每列或每行的非NA单元格数量。
cov([min_periods, numeric_only, split_every])计算列之间的成对协方差,排除NA/空值。
cummax([axis, skipna])返回 DataFrame 或 Series 轴上的累积最大值。
cummin([axis, skipna])返回 DataFrame 或 Series 轴上的累积最小值。
cumprod([axis, skipna])返回 DataFrame 或 Series 轴上的累积乘积。
cumsum([axis, skipna])返回 DataFrame 或 Series 轴上的累积和。
describe([split_every, percentiles, ...])生成描述性统计数据。
diff([periods, axis])元素的第一次离散差分。
div(other[, axis, level, fill_value])divide(other[, axis, level, fill_value])dot(other[, meta])计算 Series 与 other 列之间的点积。
drop([labels, axis, columns, errors])从行或列中删除指定的标签。
drop_duplicates([subset, split_every, ...])返回删除重复行后的DataFrame。
dropna([how, subset, thresh])移除缺失值。
enforce_runtime_divisions()在运行时强制执行当前分区。
eq(other[, level, axis])eval(expr, **kwargs)评估一个描述对DataFrame列进行操作的字符串。
explain([stage, format])创建表达式的图形表示。
explode(column)将类似列表的每个元素转换为一行,复制索引值。
ffill([axis, limit])通过将最后一个有效观测值传播到下一个有效值来填充 NA/NaN 值。
fillna([value, axis])使用指定方法填充 NA/NaN 值。
floordiv(other[, axis, level, fill_value])from_dict(data, *[, npartitions, orient, ...])从 Python 字典构建 Dask DataFrame
ge(other[, level, axis])获取表示第 nth 分区的 dask DataFrame/Series。
groupby(by[, group_keys, sort, observed, dropna])使用映射器或按列的Series对DataFrame进行分组。
gt(other[, level, axis])head([n, npartitions, compute])数据集的前 n 行
idxmax([axis, skipna, numeric_only, split_every])返回请求轴上最大值的第一个出现的索引。
idxmin([axis, skipna, numeric_only, split_every])返回请求轴上最小值的首次出现的索引。
info([buf, verbose, memory_usage])Dask DataFrame 的简要概述
isin(values)DataFrame 中的每个元素是否包含在值中。
isna()检测缺失值。
isnull()DataFrame.isnull 是 DataFrame.isna 的别名。
items()遍历 (列名, 系列) 对。
iterrows()遍历 DataFrame 行作为 (索引, 系列) 对。
itertuples([index, name])将 DataFrame 行作为命名元组进行迭代。
join(other[, on, how, lsuffix, rsuffix, ...])连接另一个DataFrame的列。
kurt([axis, fisher, bias, nan_policy, ...])返回请求轴上的无偏峰度。
kurtosis([axis, fisher, bias, nan_policy, ...])返回请求轴上的无偏峰度。
le(other[, level, axis])lower_once()lt(other[, level, axis])map(func[, na_action, meta])map_overlap(func, before, after, *args[, ...])对每个分区应用一个函数,与相邻分区共享行。
map_partitions(func, *args[, meta, ...])将一个Python函数应用于每个分区
mask(cond[, other])替换条件为 True 的值。
max([axis, skipna, numeric_only, split_every])返回请求轴上的值的最大值。
mean([axis, skipna, numeric_only, split_every])返回请求轴上值的平均值。
median([axis, numeric_only])返回请求轴上值的中位数。
median_approximate([axis, method, numeric_only])返回请求轴上值的近似中位数。
melt([id_vars, value_vars, var_name, ...])将DataFrame从宽格式透视为长格式,可以选择保留标识符集。
memory_usage([deep, index])返回每个列的内存使用情况,以字节为单位。
memory_usage_per_partition([index, deep])返回每个分区的内存使用情况
merge(right[, how, on, left_on, right_on, ...])将 DataFrame 与另一个 DataFrame 合并
min([axis, skipna, numeric_only, split_every])返回请求轴上值的最小值。
mod(other[, axis, level, fill_value])mode([dropna, split_every, numeric_only])获取所选轴上每个元素的模式。
mul(other[, axis, level, fill_value])ne(other[, level, axis])nlargest([n, columns, split_every])返回按 columns 降序排列的前 n 行。
notnull()DataFrame.notnull 是 DataFrame.notna 的别名。
nsmallest([n, columns, split_every])返回按 columns 升序排列的前 n 行。
nunique([axis, dropna, split_every])计算指定轴上的不同元素的数量。
nunique_approx([split_every])唯一行的近似数量。
optimize([fuse])优化 DataFrame。
persist([fuse])将此 dask 集合持久化到内存中
pipe(func, *args, **kwargs)应用期望 Series 或 DataFrame 的可链式函数。
pivot_table(index, columns, values[, aggfunc])创建一个电子表格样式的数据透视表作为DataFrame。
pop(item)返回项目并从框架中移除。
pow(other[, axis, level, fill_value])pprint()输出 DataFrame 的字符串表示形式。
prod([axis, skipna, numeric_only, ...])返回请求轴上值的乘积。
product([axis, skipna, numeric_only, ...])返回请求轴上值的乘积。
quantile([q, axis, numeric_only, method])DataFrame 的近似行方向和精确列方向的分位数
query(expr, **kwargs)使用复杂表达式过滤数据框
radd(other[, axis, level, fill_value])random_split(frac[, random_state, shuffle])伪随机地将数据框按行分割成不同的部分
rdiv(other[, axis, level, fill_value])reduction(chunk[, aggregate, combine, meta, ...])通用行级归约。
rename([index, columns])重命名列或索引标签。
rename_axis([mapper, index, columns, axis])设置索引或列的轴名称。
repartition([divisions, npartitions, ...])重新分配一个集合
replace([to_replace, value, regex])将 to_replace 中的值替换为 value。
resample(rule[, closed, label])重采样时间序列数据。
reset_index([drop])将索引重置为默认索引。
rfloordiv(other[, axis, level, fill_value])rmod(other[, axis, level, fill_value])rmul(other[, axis, level, fill_value])rolling(window, **kwargs)提供滚动变换功能。
round([decimals])将 DataFrame 四舍五入到可变的小数位数。
rpow(other[, axis, level, fill_value])rsub(other[, axis, level, fill_value])rtruediv(other[, axis, level, fill_value])sample([n, frac, replace, random_state])随机样本项
select_dtypes([include, exclude])根据列的数据类型返回DataFrame列的子集。
sem([axis, skipna, ddof, split_every, ...])返回请求轴上的无偏标准误差。
set_index(other[, drop, sorted, ...])使用现有列设置 DataFrame 索引(行标签)。
shift([periods, freq, axis])通过可选的时间 freq 将索引按所需周期数进行移位。
shuffle([on, ignore_index, npartitions, ...])将 DataFrame 重新排列为新的分区
simplify()skew([axis, bias, nan_policy, numeric_only])返回请求轴上的无偏斜度。
sort_values(by[, npartitions, ascending, ...])按单列对数据集进行排序。
squeeze([axis])将一维轴对象压缩为标量。
std([axis, skipna, ddof, numeric_only, ...])返回请求轴上的样本标准差。
sub(other[, axis, level, fill_value])sum([axis, skipna, numeric_only, min_count, ...])返回请求轴上值的总和。
tail([n, compute])数据集的最后 n 行
to_backend([backend])切换到新的 DataFrame 后端
to_bag([index, format])从 Series 创建一个 Dask Bag
to_csv(filename, **kwargs)更多信息请参阅 dd.to_csv 的文档字符串
to_dask_array([lengths, meta, optimize])将 dask DataFrame 转换为 dask 数组。
to_dask_dataframe(*args, **kwargs)转换为旧版 dask-dataframe 集合
to_delayed([optimize_graph])转换为一个
dask.delayed对象列表,每个分区一个。to_hdf(path_or_buf, key[, mode, append])更多信息请参见 dd.to_hdf 的文档字符串
to_html([max_rows])将 DataFrame 渲染为 HTML 表格。
to_json(filename, *args, **kwargs)更多信息请参见 dd.to_json 的文档字符串
to_legacy_dataframe([optimize])转换为旧版 dask-dataframe 集合
to_orc(path, *args, **kwargs)更多信息请参见 dd.to_orc 的文档字符串
to_parquet(path, **kwargs)to_records([index, lengths])to_sql(name, uri[, schema, if_exists, ...])to_string([max_rows])将 DataFrame 渲染为控制台友好的表格输出。
to_timestamp([freq, how])将时间戳转换为 DatetimeIndex,位于周期的 开始。
truediv(other[, axis, level, fill_value])var([axis, skipna, ddof, numeric_only, ...])返回请求轴上的无偏方差。
visualize([tasks])可视化表达式或任务图
where(cond[, other])替换条件为 False 的值。
属性
axesdasknpartitions + 1值的元组,按升序排列,标记每个分区索引的下限/上限。返回数据类型
emptyexpr纯基于位置的整数索引,用于按位置选择。
返回 dask 索引实例
是否已知分区。
纯标签位置索引器,用于按标签选择。
nbytes返回维度
返回分区数量
按分区切片数据框
Series 或 DataFrame 的大小作为 Delayed 对象。
返回此数据框值的 dask.array