Skip to contents

Import data

Functions to import data as Polars DataFrames (read_ functions) and LazyFrames (scan_ functions).

read_csv_polars() scan_csv_polars()
Import data from CSV file(s)
read_ipc_polars() scan_ipc_polars()
Import data from IPC file(s)
read_ndjson_polars() scan_ndjson_polars()
Import data from NDJSON file(s)
read_parquet_polars() scan_parquet_polars()
Import data from Parquet file(s)

Export data

Functions to export Polars DataFrames (write_ functions) and LazyFrames (sink_ functions).

sink_csv()
Stream output to a CSV file
sink_ipc()
Stream output to an IPC file
sink_ndjson()
Stream output to a NDJSON file
sink_parquet()
Stream output to a parquet file
write_csv_polars()
Export data to CSV file(s)
write_ipc_polars()
Export data to IPC file(s)
write_json_polars()
Export data to JSON file(s)
write_ndjson_polars()
Export data to NDJSON file(s)
write_parquet_polars()
Export data to Parquet file(s)

Functions from dplyr

count(<polars_data_frame>) tally(<polars_data_frame>) count(<polars_lazy_frame>) tally(<polars_lazy_frame>) add_count(<polars_data_frame>) add_count(<polars_lazy_frame>)
Count the observations in each group
semi_join(<polars_data_frame>) anti_join(<polars_data_frame>) semi_join(<polars_lazy_frame>) anti_join(<polars_lazy_frame>)
Filtering joins
arrange(<polars_data_frame>)
Order rows using column values
bind_cols_polars()
Append multiple Data/LazyFrames next to each other
bind_rows_polars()
Stack multiple Data/LazyFrames on top of each other
compute(<polars_lazy_frame>) collect(<polars_lazy_frame>)
Run computations on a LazyFrame
cross_join(<polars_data_frame>) cross_join(<polars_lazy_frame>)
Cross join
distinct(<polars_data_frame>) distinct(<polars_lazy_frame>) duplicated_rows()
Remove or keep only duplicated rows in a Data/LazyFrame
explain(<polars_lazy_frame>)
Show the optimized and non-optimized query plans
filter(<polars_data_frame>) filter(<polars_lazy_frame>)
Keep rows that match a condition
left_join(<polars_data_frame>) right_join(<polars_data_frame>) full_join(<polars_data_frame>) inner_join(<polars_data_frame>) left_join(<polars_lazy_frame>) right_join(<polars_lazy_frame>) full_join(<polars_lazy_frame>) inner_join(<polars_lazy_frame>)
Mutating joins
group_by(<polars_data_frame>) ungroup(<polars_data_frame>) group_by(<polars_lazy_frame>) ungroup(<polars_lazy_frame>)
Group by one or more variables
group_split(<polars_data_frame>)
Grouping metadata
group_vars(<polars_data_frame>) group_vars(<polars_lazy_frame>) group_keys(<polars_data_frame>) group_keys(<polars_lazy_frame>)
Grouping metadata
mutate(<polars_data_frame>) mutate(<polars_lazy_frame>)
Create, modify, and delete columns
pull(<polars_data_frame>) pull(<polars_lazy_frame>)
Extract a variable of a Data/LazyFrame
relocate(<polars_data_frame>) relocate(<polars_lazy_frame>)
Change column order
rename(<polars_data_frame>) rename(<polars_lazy_frame>) rename_with(<polars_data_frame>) rename_with(<polars_lazy_frame>)
Rename columns
rowwise(<polars_data_frame>) rowwise(<polars_lazy_frame>)
Group input by rows
select(<polars_data_frame>) select(<polars_lazy_frame>)
Select columns from a Data/LazyFrame
separate(<polars_data_frame>) separate(<polars_lazy_frame>)
Separate a character column into multiple columns based on a substring
slice_tail(<polars_data_frame>) slice_tail(<polars_lazy_frame>) slice_head(<polars_data_frame>) slice_head(<polars_lazy_frame>) slice_sample(<polars_data_frame>)
Subset rows of a Data/LazyFrame
summarize(<polars_data_frame>) summarise(<polars_data_frame>) summarize(<polars_lazy_frame>) summarise(<polars_lazy_frame>)
Summarize each group down to one row

Functions from tidyr

complete(<polars_data_frame>) complete(<polars_lazy_frame>)
Complete a data frame with missing combinations of data
drop_na(<polars_data_frame>) drop_na(<polars_lazy_frame>)
Drop missing values
fill(<polars_data_frame>)
Fill in missing values with previous or next value
pivot_longer(<polars_data_frame>) pivot_longer(<polars_lazy_frame>)
Pivot a Data/LazyFrame from wide to long
pivot_wider(<polars_data_frame>)
Pivot a DataFrame from long to wide
replace_na(<polars_data_frame>) replace_na(<polars_lazy_frame>)
Replace NAs with specified values
separate(<polars_data_frame>) separate(<polars_lazy_frame>)
Separate a character column into multiple columns based on a substring
uncount(<polars_data_frame>) uncount(<polars_lazy_frame>)
Uncount a Data/LazyFrame
unite(<polars_data_frame>) unite(<polars_lazy_frame>)
Unite multiple columns into one by pasting strings together

Other methods

Other functions or S3 methods.

summary(<polars_data_frame>)
Summary statistics for a Polars DataFrame
tidypolars_options
tidypolars global options

Other Polars functions

Other Polars-specific functions (most are deprecated).

describe() deprecated
Summary statistics for a Polars DataFrame
describe_plan() describe_optimized_plan() deprecated
Show the optimized and non-optimized query plans
fetch() deprecated
Fetch n rows of a LazyFrame
make_unique_id()
Create a column with unique id per row values
partition_by_key() partition_by_max_size() experimental
Helper functions to export a LazyFrame as a partitioned output