Column Operations

Expression methods

__add__

Addition +

__and__

Boolean AND (__and__)

__eq__

Equality comparison ==

__floordiv__

Integer division //

__ge__

Greater than or equal to comparison >=

__gt__

Greater than comparison >

__invert__

Boolean inversion (__invert__)

__le__

Less than or equal to comparison <=

__lt__

Less than comparison <

__mod__

The remainder of integer division %

__mul__

Multiplication *

__ne__

Non-equality comparison !=

__neg__

The unary - (negation) operator (__neg__)

__or__

Boolean OR (__or__)

__pos__

The unary + operator (__pos__)

__pow__

Computes the power x ** y.

__sub__

Subtraction -

__truediv__

True division /

__xor__

Boolean XOR (__xor__)

abs

Computes the absolute value.

acos

Computes the inverse cosine.

all

Indicates whether every non-null value in a group is True.

any

Indicates whether at least one value in a group is True.

ascending

The default ordering.

asin

Computes the inverse sine.

atan

Computes the inverse tangent.

cast

Cast to a different data type.

cbrt

Computes the cube root.

ceil

Returns the smallest integer greater than or equal to the input.

clip

Replaces values outside [lower_bound, upper_bound] with the closer boundary value.

cos

Computes the cosine.

count

Counts the number of non-null elements in the column.

cum_sum

The sum of all preceding elements and the current element.

dense_rank

Alias for dense_rank.

descending

Reverses the default ordering.

dt.day

The day component of the date or datetime.

dt.day_of_week

The number of the current weekday.

dt.day_of_year

The number of days since the beginning of the year.

dt.hour

The hour component of the datetime.

dt.microsecond

The microsecond component of the datetime.

dt.millisecond

The microsecond component of the datetime int-divided by 1000 (see polars).

dt.minute

The minute component of the datetime.

dt.month

The month component of the date or datetime.

dt.second

The second component of the datetime.

dt.year

The year component of the date or datetime.

dur.days

dur.hours

dur.microseconds

dur.milliseconds

dur.minutes

dur.seconds

exp

Computes the exponential function.

fill_null

Replaces every null by the given value.

floor

Returns the largest integer less than or equal to the input.

is_in

Whether the value equals one of the given.

is_inf

Whether the number is infinite.

is_nan

is_not_inf

is_not_nan

is_not_null

Indicates whether the value is not null.

is_null

Indicates whether the value is null.

list.agg

Collect the elements of each group in a list.

log

Computes the natural logarithm.

log10

Computes the base-10 logarithm.

map

Replaces given values by other expressions.

max

Computes the maximum value in each group.

mean

Computes the average value in each group.

min

Computes the minimum value in each group.

nulls_first

Specifies that nulls are placed at the beginning of the ordering.

nulls_last

Specifies that nulls are placed at the end of the ordering.

rank

Alias for rank.

round

Rounds to a given number of decimals.

shift

Shifts values in the column by an offset.

sin

Computes the sine.

sqrt

Computes the square root.

str.contains

Whether the string contains a given pattern or substring.

str.ends_with

Whether the string ends with a given suffix.

str.join

Concatenates all strings in a group to a single string.

str.len

Computes the length of the string.

str.lower

Converts all alphabet letters to lower case.

str.replace_all

Replaces all occurrences of a given substring by a different string.

str.slice

Returns a substring of the input string.

str.starts_with

Whether the string starts with a given prefix.

str.strip

Removes leading and trailing whitespace.

str.to_date

str.to_datetime

str.upper

Converts all alphabet letters to upper case.

sum

Computes the sum of values in each group.

tan

Computes the tangent.

Global functions

all

any

coalesce

Returns the first non-null value among the given.

count

Returns the number of rows of the current table, like COUNT(*) in SQL.

dense_rank

The number of smaller or equal values in the column (not counting duplicates).

lit

Creates a pydiverse.transform expression from a python builtin type.

max

The maximum of the given columns.

min

The minimum of the given columns.

rand

Generates a column of random floating point number between 0 and 1.

rank

The number of strictly smaller elements in the column plus one.

row_number

Computes the index of a row.

sum

when