dask.dataframe.DataFrame

class dask.dataframe.DataFrame(dsk, name, meta, divisions)[source]

Parallel Pandas DataFrame

Do not use this class directly. Instead use functions like dd.read_csv, dd.read_parquet, or dd.from_pandas.

Parameters
dsk: dict

The dask graph to compute this DataFrame

name: str

The key prefix that specifies which keys in the dask comprise this particular DataFrame

meta: pandas.DataFrame

An empty pandas.DataFrame with names, dtypes, and index matching the expected output.

divisions: tuple of index values

Values along which we partition our blocks on the index

__init__(dsk, name, meta, divisions)[source]

Methods

__init__(dsk, name, meta, divisions)

abs()

Return a Series/DataFrame with absolute numeric value of each element.

add(other[, axis, level, fill_value])

Get Addition of dataframe and other, element-wise (binary operator add).

add_prefix(prefix)

Prefix labels with string prefix.

add_suffix(suffix)

Suffix labels with string suffix.

align(other[, join, axis, fill_value])

Align two objects on their axes with the specified join method.

all([axis, skipna, split_every, out])

Return whether all elements are True, potentially over an axis.

any([axis, skipna, split_every, out])

Return whether any element is True, potentially over an axis.

append(other[, interleave_partitions])

Append rows of other to the end of caller, returning a new object.

apply(func[, axis, broadcast, raw, reduce, ...])

Parallel version of pandas.DataFrame.apply

applymap(func[, meta])

Apply a function to a Dataframe elementwise.

assign(**kwargs)

Assign new columns to a DataFrame.

astype(dtype)

Cast a pandas object to a specified dtype dtype.

bfill([axis, limit])

categorize([columns, index, split_every])

Convert columns of the DataFrame to category dtype.

clear_divisions()

Forget division information

clip([lower, upper, out])

clip_lower(threshold)

clip_upper(threshold)

combine(other, func[, fill_value, overwrite])

Perform column-wise combine with another DataFrame.

combine_first(other)

Update null elements with value in the same location in other.

compute(**kwargs)

Compute this dask collection

copy([deep])

Make a copy of the dataframe

corr([method, min_periods, split_every])

Compute pairwise correlation of columns, excluding NA/null values.

count([axis, split_every, numeric_only])

Count non-NA cells for each column or row.

cov([min_periods, split_every])

Compute pairwise covariance of columns, excluding NA/null values.

cummax([axis, skipna, out])

Return cumulative maximum over a DataFrame or Series axis.

cummin([axis, skipna, out])

Return cumulative minimum over a DataFrame or Series axis.

cumprod([axis, skipna, dtype, out])

Return cumulative product over a DataFrame or Series axis.

cumsum([axis, skipna, dtype, out])

Return cumulative sum over a DataFrame or Series axis.

describe([split_every, percentiles, ...])

Generate descriptive statistics.

diff([periods, axis])

First discrete difference of element.

div(other[, axis, level, fill_value])

Get Floating division of dataframe and other, element-wise (binary operator truediv).

divide(other[, axis, level, fill_value])

Get Floating division of dataframe and other, element-wise (binary operator truediv).

dot(other[, meta])

Compute the dot product between the Series and the columns of other.

drop([labels, axis, columns, errors])

Drop specified labels from rows or columns.

drop_duplicates([subset, split_every, ...])

Return DataFrame with duplicate rows removed.

dropna([how, subset, thresh])

Remove missing values.

eq(other[, axis, level])

Get Equal to of dataframe and other, element-wise (binary operator eq).

eval(expr[, inplace])

Evaluate a string describing operations on DataFrame columns.

explode(column)

Transform each element of a list-like to a row, replicating index values.

ffill([axis, limit])

fillna([value, method, limit, axis])

Fill NA/NaN values using the specified method.

first(offset)

Select initial periods of time series data based on a date offset.

floordiv(other[, axis, level, fill_value])

Get Integer division of dataframe and other, element-wise (binary operator floordiv).

ge(other[, axis, level])

Get Greater than or equal to of dataframe and other, element-wise (binary operator ge).

get_dtype_counts()

get_ftype_counts()

get_partition(n)

Get a dask DataFrame/Series representing the nth partition.

groupby([by, group_keys, sort, observed, dropna])

Group DataFrame using a mapper or by a Series of columns.

gt(other[, axis, level])

Get Greater than of dataframe and other, element-wise (binary operator gt).

head([n, npartitions, compute])

First n rows of the dataset

idxmax([axis, skipna, split_every])

Return index of first occurrence of maximum over requested axis.

idxmin([axis, skipna, split_every])

Return index of first occurrence of minimum over requested axis.

info([buf, verbose, memory_usage])

Concise summary of a Dask DataFrame.

isin(values)

Whether each element in the DataFrame is contained in values.

isna()

Detect missing values.

isnull()

Detect missing values.

items()

Iterate over (column name, Series) pairs.

iterrows()

Iterate over DataFrame rows as (index, Series) pairs.

itertuples([index, name])

Iterate over DataFrame rows as namedtuples.

join(other[, on, how, lsuffix, rsuffix, ...])

Join columns of another DataFrame.

kurtosis([axis, fisher, bias, nan_policy, ...])

Return unbiased kurtosis over requested axis.

last(offset)

Select final periods of time series data based on a date offset.

le(other[, axis, level])

Get Less than or equal to of dataframe and other, element-wise (binary operator le).

lt(other[, axis, level])

Get Less than of dataframe and other, element-wise (binary operator lt).

map_overlap(func, before, after, *args, **kwargs)

Apply a function to each partition, sharing rows with adjacent partitions.

map_partitions(func, *args, **kwargs)

Apply Python function on each DataFrame partition.

mask(cond[, other])

max([axis, skipna, split_every, out, ...])

Return the maximum of the values over the requested axis.

mean([axis, skipna, split_every, dtype, ...])

Return the mean of the values over the requested axis.

melt([id_vars, value_vars, var_name, ...])

Unpivots a DataFrame from wide format to long format, optionally leaving identifier variables set.

memory_usage([index, deep])

Return the memory usage of each column in bytes.

memory_usage_per_partition([index, deep])

Return the memory usage of each partition

merge(right[, how, on, left_on, right_on, ...])

Merge the DataFrame with another DataFrame

min([axis, skipna, split_every, out, ...])

Return the minimum of the values over the requested axis.

mod(other[, axis, level, fill_value])

Get Modulo of dataframe and other, element-wise (binary operator mod).

mode([dropna, split_every])

Get the mode(s) of each element along the selected axis.

mul(other[, axis, level, fill_value])

Get Multiplication of dataframe and other, element-wise (binary operator mul).

ne(other[, axis, level])

Get Not equal to of dataframe and other, element-wise (binary operator ne).

nlargest([n, columns, split_every])

Return the first n rows ordered by columns in descending order.

notnull()

Detect existing (non-missing) values.

nsmallest([n, columns, split_every])

Return the first n rows ordered by columns in ascending order.

nunique_approx([split_every])

Approximate number of unique rows.

persist(**kwargs)

Persist this dask collection into memory

pipe(func, *args, **kwargs)

Apply func(self, *args, **kwargs).

pivot_table([index, columns, values, aggfunc])

Create a spreadsheet-style pivot table as a DataFrame.

pop(item)

Return item and drop from frame.

pow(other[, axis, level, fill_value])

Get Exponential power of dataframe and other, element-wise (binary operator pow).

prod([axis, skipna, split_every, dtype, ...])

Return the product of the values over the requested axis.

product([axis, skipna, split_every, dtype, ...])

Return the product of the values over the requested axis.

quantile([q, axis, method])

Approximate row-wise and precise column-wise quantiles of DataFrame

query(expr, **kwargs)

Filter dataframe with complex expression

radd(other[, axis, level, fill_value])

Get Addition of dataframe and other, element-wise (binary operator radd).

random_split(frac[, random_state, shuffle])

Pseudorandomly split dataframe into different pieces row-wise

rdiv(other[, axis, level, fill_value])

Get Floating division of dataframe and other, element-wise (binary operator rtruediv).

reduction(chunk[, aggregate, combine, meta, ...])

Generic row-wise reductions.

rename([index, columns])

Alter axes labels.

repartition([divisions, npartitions, ...])

Repartition dataframe along new divisions

replace([to_replace, value, regex])

Replace values given in to_replace with value.

resample(rule[, closed, label])

Resample time-series data.

reset_index([drop])

Reset the index to the default index.

rfloordiv(other[, axis, level, fill_value])

Get Integer division of dataframe and other, element-wise (binary operator rfloordiv).

rmod(other[, axis, level, fill_value])

Get Modulo of dataframe and other, element-wise (binary operator rmod).

rmul(other[, axis, level, fill_value])

Get Multiplication of dataframe and other, element-wise (binary operator rmul).

rolling(window[, min_periods, center, ...])

Provides rolling transformations.

round([decimals])

Round a DataFrame to a variable number of decimal places.

rpow(other[, axis, level, fill_value])

Get Exponential power of dataframe and other, element-wise (binary operator rpow).

rsub(other[, axis, level, fill_value])

Get Subtraction of dataframe and other, element-wise (binary operator rsub).

rtruediv(other[, axis, level, fill_value])

Get Floating division of dataframe and other, element-wise (binary operator rtruediv).

sample([n, frac, replace, random_state])

Random sample of items

select_dtypes([include, exclude])

Return a subset of the DataFrame's columns based on the column dtypes.

sem([axis, skipna, ddof, split_every, ...])

Return unbiased standard error of the mean over requested axis.

set_index(other[, drop, sorted, ...])

Set the DataFrame index (row labels) using an existing column.

shift([periods, freq, axis])

Shift index by desired number of periods with an optional time freq.

shuffle(on[, npartitions, max_branch, ...])

Rearrange DataFrame into new partitions

skew([axis, bias, nan_policy, out, numeric_only])

Return unbiased skew over requested axis.

sort_values(by[, npartitions, ascending])

Sort the dataset by a single column.

squeeze([axis])

Squeeze 1 dimensional axis objects into scalars.

std([axis, skipna, ddof, split_every, ...])

Return sample standard deviation over requested axis.

sub(other[, axis, level, fill_value])

Get Subtraction of dataframe and other, element-wise (binary operator sub).

sum([axis, skipna, split_every, dtype, out, ...])

Return the sum of the values over the requested axis.

tail([n, compute])

Last n rows of the dataset

to_bag([index, format])

Create Dask Bag from a Dask DataFrame

to_csv(filename, **kwargs)

Store Dask DataFrame to CSV files

to_dask_array([lengths, meta])

Convert a dask DataFrame to a dask array.

to_delayed([optimize_graph])

Convert into a list of dask.delayed objects, one per partition.

to_hdf(path_or_buf, key[, mode, append])

Store Dask Dataframe to Hierarchical Data Format (HDF) files

to_html([max_rows])

Render a DataFrame as an HTML table.

to_json(filename, *args, **kwargs)

See dd.to_json docstring for more information

to_orc(path, *args, **kwargs)

See dd.to_orc docstring for more information

to_parquet(path, *args, **kwargs)

Store Dask.dataframe to Parquet files

to_records([index, lengths])

Create Dask Array from a Dask Dataframe

to_sql(name, uri[, schema, if_exists, ...])

See dd.to_sql docstring for more information

to_string([max_rows])

Render a DataFrame to a console-friendly tabular output.

to_timestamp([freq, how, axis])

Cast to DatetimeIndex of timestamps, at beginning of period.

truediv(other[, axis, level, fill_value])

Get Floating division of dataframe and other, element-wise (binary operator truediv).

var([axis, skipna, ddof, split_every, ...])

Return unbiased variance over requested axis.

visualize([filename, format, optimize_graph])

Render the computation of this object's task graph using graphviz.

where(cond[, other])

Attributes

attrs

Dictionary of global attributes of this dataset.

axes

columns

dtypes

Return data types

empty

iloc

Purely integer-location based indexing for selection by position.

index

Return dask Index instance

known_divisions

Whether divisions are already known

loc

Purely label-location based indexer for selection by label.

ndim

Return dimensionality

npartitions

Return number of partitions

partitions

Slice dataframe by partitions

shape

Return a tuple representing the dimensionality of the DataFrame.

size

Size of the Series or DataFrame as a Delayed object.

values

Return a dask.array of the values of this dataframe