Functions#

Conversion#

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

Create a DataFrame or Series from an Arrow Table or Array.

from_dataframe(df, *[, allow_copy])

Build a Polars DataFrame from any dataframe supporting the interchange protocol.

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

Construct a DataFrame from a dictionary of sequences.

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

Construct a DataFrame from a sequence of dictionaries.

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

Construct a DataFrame from a NumPy ndarray.

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

Construct a Polars DataFrame or Series from a pandas DataFrame, Series, or Index.

from_records(data[, schema, ...])

Construct a DataFrame from a sequence of sequences.

from_repr(data)

Construct a Polars DataFrame or Series from its string representation.

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

Normalize semi-structured deserialized JSON data into a flat table.

Miscellaneous#

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

Align a sequence of frames using common values from one or more columns as a key.

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

Combine multiple DataFrames, LazyFrames, or Series into a single object.

escape_regex(s)

Escapes string regex meta characters.

Parallelization#

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

Collect multiple LazyFrames at the same time.

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

Collect multiple LazyFrames at the same time asynchronously in thread pool.

Random#

set_random_seed(seed)

Set the global random seed for Polars.

StringCache#

Note that the StringCache can be used as both a context manager and a decorator, in order to explicitly scope cache lifetime.

StringCache()

Context manager for enabling and disabling the global string cache.

enable_string_cache()

Enable the global string cache.

disable_string_cache()

Disable and clear the global string cache.

using_string_cache()

Check whether the global string cache is enabled.