函数#

转换#

from_arrow(数据[, 模式, 模式覆盖, ...])

从Arrow表或数组创建DataFrame或Series。

from_dataframe(df, *[, allow_copy])

从支持交换协议的任何数据框构建一个Polars数据框。

from_dict(data[, schema, schema_overrides, ...])

从序列的字典中构造一个DataFrame。

from_dicts(数据[, 模式, 模式覆盖, ...])

从字典序列构造一个DataFrame。

from_numpy(数据[, 模式, 模式覆盖, ...])

从NumPy ndarray构建一个DataFrame。

from_pandas(data, *[, schema_overrides, ...])

从pandas的DataFrame、Series或Index构建一个Polars的DataFrame或Series。

from_records(数据[, 模式, ...])

从序列的序列中构造一个DataFrame。

from_repr(data)

从其字符串表示形式构造一个Polars DataFrame或Series。

json_normalize(data, *[, separator, ...])

将半结构化的反序列化JSON数据规范化为一个扁平表。

杂项#

align_frames(*frames, on[, how, select, ...])

使用一个或多个列中的共同值作为键来对齐一系列帧。

concat(items, *[, how, rechunk, parallel])

将多个DataFrames、LazyFrames或Series合并为一个对象。

escape_regex(s)

转义字符串正则表达式元字符。

并行化#

collect_all(lazy_frames, *[, type_coercion, ...])

同时收集多个LazyFrames。

collect_all_async(lazy_frames, *[, gevent, ...])

在线程池中异步同时收集多个LazyFrames。

随机#

set_random_seed(seed)

为Polars设置全局随机种子。

字符串缓存#

请注意,StringCache 可以用作上下文管理器和装饰器,以明确缓存的生命周期。

StringCache()

用于启用和禁用全局字符串缓存的上下文管理器。

enable_string_cache()

启用全局字符串缓存。

disable_string_cache()

禁用并清除全局字符串缓存。

using_string_cache()

检查全局字符串缓存是否已启用。