DataFrame#
A Daft DataFrame is a table of data. |
Note
Most DataFrame methods are lazy, meaning that they do not execute computation immediately when invoked. Instead, these operations are enqueued in the DataFrame’s internal query plan, and are only executed when Execution DataFrame methods are called.
Data Manipulation#
Selecting Columns#
Gets a column from the DataFrame as an Expression ( |
Manipulating Columns#
Creates a new DataFrame from the provided expressions, similar to a SQL |
|
Adds a column to the current DataFrame with an Expression, equivalent to a |
|
Adds columns to the current DataFrame with Expressions, equivalent to a |
|
Pivots a column of the DataFrame and performs an aggregation on the values. |
|
Drops columns from the current DataFrame by name |
|
Explodes a List column, where every element in each row's List becomes its own row, and all other columns in the DataFrame are duplicated across rows |
|
Unpivots a DataFrame from wide to long format. |
|
Alias for unpivot |
|
Apply a function that takes and returns a DataFrame. |
Filtering Rows#
Computes unique rows, dropping duplicates |
|
Filters rows via a predicate expression, similar to SQL |
|
Filters rows via a predicate expression, similar to SQL |
|
Limits the rows in the DataFrame to the first |
|
Samples a fraction of rows from the DataFrame |
Reordering#
Sorts DataFrame globally |
|
Repartitions DataFrame to |
|
Splits or coalesces DataFrame to |
Combining#
Column-wise join of the current DataFrame with an |
|
Concatenates two DataFrames together in a "vertical" concatenation. |
Aggregations#
Performs a GroupBy on the DataFrame for aggregation |
|
Performs a global sum on the DataFrame |
|
Performs a global mean on the DataFrame |
|
Performs a global standard deviation on the DataFrame |
|
Performs a global count on the DataFrame |
|
Performs a global min on the DataFrame |
|
Performs a global max on the DataFrame |
|
Perform aggregations on this DataFrame. |
Execution#
Note
These methods will execute the operations in your DataFrame and are blocking.
Data Retrieval#
These methods will run the dataframe and retrieve them to where the code is being run.
Converts the current DataFrame to a python dictionary. |
|
Converts the current Dataframe into a python list. .. WARNING::. |
|
Begin executing this dataframe and return an iterator over the partitions. |
|
Return an iterator of rows for this dataframe. |
Materialization#
Executes the entire DataFrame and materializes the results |
Visualization#
Executes enough of the DataFrame in order to display the first |
Writing Data#
Writes the DataFrame as parquet files, returning a new DataFrame with paths to the files that were written |
|
Writes the DataFrame as CSV files, returning a new DataFrame with paths to the files that were written |
|
Writes the DataFrame to an Iceberg table, returning a new DataFrame with the operations that occurred. |
|
Writes the DataFrame to a Delta Lake table, returning a new DataFrame with the operations that occurred. |
Integrations#
Converts the current DataFrame to a pyarrow Table. |
|
Converts the current DataFrame to a pandas DataFrame. |
|
Convert the current DataFrame into a map-style Torch Dataset for use with PyTorch. |
|
Convert the current DataFrame into a Torch IterableDataset for use with PyTorch. |
|
Converts the current DataFrame to a Ray Dataset which is useful for running distributed ML model training in Ray |
|
Converts the current Daft DataFrame to a Dask DataFrame. |
Schema and Lineage#
Prints the (logical and physical) plans that will be executed to produce this DataFrame. |
|
Returns the Schema of the DataFrame, which provides information about each column |
|
Returns column names of DataFrame as a list of strings. |