ExPolars.DataFrame (ExPolars v0.3.1-dev) View Source

Link to this section Summary

Functions

Drop duplicate rows from this DataFrame. Note that this fails if there is a column of type List in the DataFrame.

Check if DataFrame is equal to other.

Explode DataFrame to long format by exploding a column with Lists.

Use multiple aggregations on columns

Count the unique values per group.

Get a mask of all duplicated rows in this DataFrame

Get a mask of all unique rows in this DataFrame

Unpivot DataFrame to long format.

Do a pivot operation based on the group key, a pivot column and an aggregation function on the values column.

Shift the values by a given period and fill the parts that will be empty due to this operation with Nones.

Link to this section Types

Specs

s() :: ExPolars.Series

Specs

t() :: ExPolars.DataFrame

Link to this section Functions

Specs

add(t() | {:ok, t()}, s() | {:ok, s()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_add/2.

Specs

clone(t() | {:ok, t()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_clone/1.

Specs

column(t() | {:ok, t()}, String.t()) :: {:ok, s() | nil} | {:error, term()}

See ExPolars.Native.df_column/2.

Specs

columns(t() | {:ok, t()}) :: {:ok, [String.t()]} | {:error, term()}

See ExPolars.Native.df_columns/1.

Specs

divide(t() | {:ok, t()}, s() | {:ok, s()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_div/2.

Specs

drop(t() | {:ok, t()}, String.t()) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_drop/2.

Link to this function

drop_duplicates(df, maintain_order \\ true, subset \\ nil)

View Source

Specs

drop_duplicates(t() | {:ok, t()}, boolean(), [String.t()] | nil) ::
  {:ok, t()} | {:error, term()}

Drop duplicate rows from this DataFrame. Note that this fails if there is a column of type List in the DataFrame.

Specs

drop_in_place(t() | {:ok, t()}, String.t()) :: {:ok, s()} | {:error, term()}

See ExPolars.Native.df_drop_in_place/2.

Specs

drop_nulls(t() | {:ok, t()}, [String.t()] | nil) ::
  {:ok, t()} | {:error, term()}

See ExPolars.Native.df_drop_nulls/2.

Link to this function

dtype(df, name, type \\ :str)

View Source

Specs

dtypes(t() | {:ok, t()}) :: {:ok, [integer()]} | {:error, term()}

See ExPolars.Native.df_dtypes/1.

Link to this function

equal(df, other, null_equal \\ false)

View Source

Specs

equal(t() | {:ok, t()}, t() | {:ok, t()}, boolean()) ::
  {:ok, boolean()} | {:error, term()}

Check if DataFrame is equal to other.

Parameters

df: DataFrame other: DataFrame to compare with. null_equal: Consider null values as equal.

Specs

explode(t() | {:ok, t()}, [String.t()]) :: {:ok, t()} | {:error, term()}

Explode DataFrame to long format by exploding a column with Lists.

Parameters

columns

Column of LargeList type

Returns


DataFrame

Specs

fill_none(t() | {:ok, t()}, String.t()) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_fill_none/2.

Specs

filter(t() | {:ok, t()}, s() | {:ok, s()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_filter/2.

Link to this function

find_idx_by_name(df, name)

View Source

Specs

find_idx_by_name(t() | {:ok, t()}, String.t()) ::
  {:ok, integer() | nil} | {:error, term()}

See ExPolars.Native.df_find_idx_by_name/2.

Specs

get_columns(t() | {:ok, t()}) :: {:ok, [s() | {:ok, s()}]} | {:error, term()}

See ExPolars.Native.df_get_columns/1.

Link to this function

groupby(df, by, sel, agg)

View Source

Specs

groupby(t() | {:ok, t()}, [String.t()], [String.t()] | nil, String.t()) ::
  {:ok, t()} | {:error, term()}

See ExPolars.Native.df_groupby/4.

Link to this function

groupby_agg(df, by, column_to_agg)

View Source

Specs

groupby_agg(
  t() | {:ok, t()},
  [String.t()],
  %{required(String.t()) => [String.t()]} | [{String.t(), [String.t()]}]
) :: {:ok, t()} | {:error, term()}

Use multiple aggregations on columns

Parameters

column_to_agg

map column to aggregation functions

Examples:
    [{"foo", ["sum", "n_unique", "min"]},
     {"bar": ["max"]}]

    {"foo": ["sum", "n_unique", "min"],
    "bar": "max"}

Returns


Result of groupby split apply operations.

Link to this function

groupby_quantile(df, by, sel, quant)

View Source

Specs

groupby_quantile(t() | {:ok, t()}, [String.t()], [String.t()], float()) ::
  {:ok, t()} | {:error, term()}

Count the unique values per group.

Specs

head(t() | {:ok, t()}, integer()) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_head/2.

Specs

height(t() | {:ok, t()}) :: {:ok, integer()} | {:error, term()}

See ExPolars.Native.df_height/1.

Specs

hstack(t() | {:ok, t()}, [s() | {:ok, s()}]) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_hstack/2.

Specs

hstack_mut(t() | {:ok, t()}, [s() | {:ok, s()}]) :: :ok | {:error, term()}

See ExPolars.Native.df_hstack_mut/2.

Link to this function

insert_at_idx(df, index, new_col)

View Source

Specs

insert_at_idx(t() | {:ok, t()}, integer(), s() | {:ok, s()}) ::
  :ok | {:error, term()}

See ExPolars.Native.df_insert_at_idx/3.

Specs

is_duplicated(t() | {:ok, t()}) :: {:ok, s()} | {:error, term()}

Get a mask of all duplicated rows in this DataFrame

Specs

is_unique(t() | {:ok, t()}) :: {:ok, s()} | {:error, term()}

Get a mask of all unique rows in this DataFrame

Link to this function

join(df, other, left_on, right_on, how)

View Source

Specs

join(t() | {:ok, t()}, t() | {:ok, t()}, [String.t()], [String.t()], String.t()) ::
  {:ok, t()} | {:error, term()}

See ExPolars.Native.df_join/5.

Specs

max(t() | {:ok, t()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_max/1.

Specs

mean(t() | {:ok, t()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_mean/1.

Specs

median(t() | {:ok, t()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_median/1.

Link to this function

melt(df, id_vars, value_vars)

View Source

Specs

melt(t() | {:ok, t()}, [String.t()], [String.t()]) ::
  {:ok, t()} | {:error, term()}

Unpivot DataFrame to long format.

Parameters

id_vars

Columns to use as identifier variables

value_vars

Values to use as identifier variables

Returns


Specs

min(t() | {:ok, t()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_min/1.

Specs

mul(t() | {:ok, t()}, s() | {:ok, s()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_mul/2.

Specs

n_chunks(t() | {:ok, t()}) :: {:ok, integer()} | {:error, term()}

See ExPolars.Native.df_n_chunks/1.

Link to this function

pivot(df, by, pivot_column, values_column, agg)

View Source

Specs

pivot(t() | {:ok, t()}, [String.t()], String.t(), String.t(), String.t()) ::
  {:ok, t()} | {:error, term()}

Do a pivot operation based on the group key, a pivot column and an aggregation function on the values column.

Parameters

pivot_column

Column to pivot.

values_column

Column that will be aggregated
Link to this function

plot_by_type(df, type, opts)

View Source

See ExPolars.Plot.plot_by_type/3.

Link to this function

plot_repeat(df, rows, colums, opts \\ [])

View Source

See ExPolars.Plot.plot_repeat/4.

Link to this function

plot_single(df, mark, x, y, opts \\ [])

View Source

See ExPolars.Plot.plot_single/5.

Specs

quantile(t() | {:ok, t()}, float()) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_quantile/2.

Link to this function

read_csv(filename, infer_schema_length \\ 100, batch_size \\ 64, has_header \\ true, ignore_errors \\ false, stop_after_n_rows \\ nil, skip_rows \\ 0, projection \\ nil, sep \\ ",", rechunk \\ true, columns \\ nil, encoding \\ "utf8")

View Source

Specs

read_csv(
  String.t(),
  integer(),
  integer(),
  boolean(),
  boolean(),
  integer() | nil,
  integer(),
  [integer()] | nil,
  String.t(),
  boolean(),
  [String.t()] | nil,
  String.t()
) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_read_csv/12.

Link to this function

read_json(filename, line_delimited_json \\ false)

View Source

Specs

read_json(String.t(), boolean()) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_read_json/2.

Specs

read_parquet(String.t()) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_read_parquet/1.

Specs

rechunk(t() | {:ok, t()}) :: :ok | {:error, term()}

See ExPolars.Native.df_rechunk/1.

Specs

remainder(t() | {:ok, t()}, s() | {:ok, s()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_rem/2.

Link to this function

replace(df, col, new_col)

View Source

Specs

replace(t() | {:ok, t()}, String.t(), s() | {:ok, s()}) ::
  :ok | {:error, term()}

See ExPolars.Native.df_replace/3.

Link to this function

replace_at_idx(df, index, new_col)

View Source

Specs

replace_at_idx(t() | {:ok, t()}, integer(), s() | {:ok, s()}) ::
  :ok | {:error, term()}

See ExPolars.Native.df_replace_at_idx/3.

Link to this function

sample(df, n_or_frac, with_replacement \\ false)

View Source

Specs

sample(t() | {:ok, t()}, integer() | float(), boolean()) ::
  {:ok, t()} | {:error, term()}

Specs

select(t() | {:ok, t()}, [String.t()]) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_select/2.

Specs

select_at_idx(t() | {:ok, t()}, integer()) ::
  {:ok, s() | nil} | {:error, term()}

See ExPolars.Native.df_select_at_idx/2.

Link to this function

set_column_names(df, names)

View Source

Specs

set_column_names(t() | {:ok, t()}, [String.t()]) :: :ok | {:error, term()}

See ExPolars.Native.df_set_column_names/2.

Specs

shape(t() | {:ok, t()}) :: {:ok, {integer(), integer()}} | {:error, term()}

See ExPolars.Native.df_shape/1.

Specs

shift(t() | {:ok, t()}, integer()) :: {:ok, t()} | {:error, term()}

Shift the values by a given period and fill the parts that will be empty due to this operation with Nones.

Parameters

periods

Number of places to shift (may be negative).
Link to this function

slice(df, offset, length)

View Source

Specs

slice(t() | {:ok, t()}, integer(), integer()) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_slice/3.

Link to this function

sort(df, by_column, inplace \\ false, reverse \\ false)

View Source

Specs

sort(t() | {:ok, t()}, String.t(), boolean(), boolean()) ::
  {:ok, t()} | {:error, term()}

Specs

std(t() | {:ok, t()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_stdev/1.

Specs

sub(t() | {:ok, t()}, s() | {:ok, s()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_sub/2.

Specs

sum(t() | {:ok, t()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_sum/1.

Specs

tail(t() | {:ok, t()}, integer()) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_tail/2.

Specs

take(t() | {:ok, t()}, [integer()]) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_take/2.

Link to this function

take_with_series(df, indices)

View Source

Specs

take_with_series(t() | {:ok, t()}, s() | {:ok, s()}) ::
  {:ok, t()} | {:error, term()}

See ExPolars.Native.df_take_with_series/2.

Link to this function

to_csv(df, batch_size \\ 100000, has_headers \\ true, delimiter \\ 44)

View Source

Specs

to_csv(t() | {:ok, t()}, integer(), boolean(), integer()) ::
  {:ok, String.t()} | {:error, term()}

See ExPolars.Native.df_to_csv/4.

Link to this function

to_csv_file(df, filename, batch_size \\ 100000, has_headers \\ true, delimiter \\ 44)

View Source

Specs

to_csv_file(t() | {:ok, t()}, String.t(), integer(), boolean(), integer()) ::
  :ok | {:error, term()}

See ExPolars.Native.df_to_csv_file/5.

Specs

to_dummies(t() | {:ok, t()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_to_dummies/1.

Specs

var(t() | {:ok, t()}) :: {:ok, t()} | {:error, term()}

See ExPolars.Native.df_var/1.

Specs

vstack(t() | {:ok, t()}, t() | {:ok, t()}) :: :ok | {:error, term()}

See ExPolars.Native.df_vstack/2.

Specs

width(t() | {:ok, t()}) :: {:ok, integer()} | {:error, term()}

See ExPolars.Native.df_width/1.