Overview
This is an index of the main functionality available in Tabeline. Each constructor and verb has a link to more detailed documentation. The expression functions do not yet have detailed documentation, but should be self-explanatory.
Creation
These are the ways to create a DataFrame from something that is not already a DataFrame
DataFrame(**columns): Construct data frame directly from columnsDataFrame.from_dict(columns): Construct data frame directly from columnsDataFrame.read_csv(filename): Read data frame from CSV fileDataFrame.from_pandas(df): Convert from PandasDataFrameDataFrame.from_polars(df): Convert from PolarsDataFrame
Export
These are the various things that a DataFrame can be converted into
to_dict(): Convert to dictionary of columnsto_pandas(): Convert to PandasDataFrameto_polars(): Convert to PolarsDataFramewrite_csv(filename): Write to CSV file
Verbs
Each verb is a method of DataFrame.
Column reorganization
Row removal
filter: Keep rows for which predicate is trueslice0: Keep rows given by 0-indexslice1: Keep rows given by 1-indexdistinct: Drop rows with duplicate values under given columnsunique: Drop rows with duplicate values under all columns
Row reordering
sort: Sort data frame according to given columnscluster: Bring rows together with same values under given columns
Column mutation
mutate: Create or update columns according to given expressionstransmute: Mutate while dropping existing columns
Grouping
Summarizing
summarize: Reduce each group to a single row according to given expressions
Reshaping
Joining
inner_join: Merge data frames, dropping unmatchedouter_join: Merge data frames, adding nulls for unmatchedleft_join: Merge data frames, adding nulls for unmatched on the left data frame
Concatenating
concatenate_rows: Concatenate rows of data framesconcatenate_columns: Concatenate columns of data frames
Functions
These are the operators and functions available in the string expressions.
Operators
If either operand is null, the result is null.
x + y:xplusyor, if strings,xconcatenated toyx - y:xminusyx * y:xtimesyx / y:xdivided byyx % y:xmodyx ** y:xto the power ofy
Numeric to numeric broadcast
The functions in this section mathematical operations on numbers. If these functions receive scalar inputs, they return a scalar. If they receive any array inputs, any scalars are interpreted as constant vectors and an array is returned. For each null element, the result is null.
abs(x): Absolute value ofxsqrt(x): Square root ofxlog(x): Natural logarithm ofxlog2(x): Base-2 logarithm ofxlog10(x): Base-10 logarithm ofxexp(x): Euler's numbereto the power ofxpow(x, y):xto the power ofysin(x): Sine ofxcos(x): Cosine ofxtan(x): Tangent ofxarcsin(x): Inverse sine ofxarccos(x): Inverse cosine ofxarctan(x): Inverse tangent ofxfloor(x):xrounded down to the nearest integerceil(x):xrounded up to the nearest integerpmax(x, y, ...): Element-wise maximum across columnspmin(x, y, ...): Element-wise minimum across columns
Numeric to boolean broadcast
For each null element, the result is null.
is_nan(x): True ifxvalue is a floating pointNaNis_finite(x): True ifxvalue is a floating point finite number
Casting broadcast
The functions in this section convert values from one type to another. These are completely dependent on the behavior of the Polars cast function. Nulls are preserved.
to_boolean(x): Convertxfrom a boolean, a float, or an integer, to a booleanto_integer(x): Convertxfrom a boolean, a float, or an integer to an integer or parse a string as an integerto_float(x): Convertxfrom a boolean, a float, or an integer to a float or parse a string as a floatto_string(x): Deparsexto a string
Other broadcast
is_null(x): True ifxis null. This is one of the few functions that returns a non-null value on null inputs.if_else(condition, true_value, false_value): Ifconditionis true, returntrue_value, otherwise returnfalse_value.
Numeric to numeric reduction
The functions in this section consume an entire column of numbers and to produce a scalar number. If any element is null, the result is null.
std(x): Population standard deviation ofxvar(x): Population variance ofxmax(x): Maximum ofxmin(x): Minimum ofxsum(x): Sum ofxmean(x): Mean ofxmedian(x): Median ofxquantile(x, quantile): Thequantileofxobtained via linear interpolationquantilemust be afloatliteral not an expressiontrapz(x, y): Numerically integrateyoverxusing the trapezoidal ruleinterp(x, xp, fp): Linearly interpolatefpoverxpatx; typically,xis a float literal
Boolean to boolean reduction
The functions in this section consume an entire column of booleans and to produce a scalar boolean. These follow Kleene logic with respect to null.
any(x): True if any ofxare trueall(x): True is all ofxare true
Any to any reduction
The functions in this section consume an entire column of anything and to produce a scalar of that type. These treat nulls as normal values.
first(x): The first value ofxlast(x): The last value ofxsame(x): One value ofxif all values ofxare the same, otherwise error
Argumentless functions
The functions in this section evalute in the context of the DataFrame, not any particular column.
n(): The number of rows in theDataFramerow_index0(): The 0-index of each rowrow_index1(): The 1-index of each row