View Source Explorer.Backend.DataFrame behaviour (Explorer v0.1.0)

The behaviour for DataFrame backends.

Link to this section Summary

Link to this section Types

@type colname() :: String.t()
@type df() :: Explorer.DataFrame.t()
@type result(t) :: {:ok, t} | {:error, term()}
@type series() :: Explorer.Series.t()
@type t() :: %{__struct__: atom()}

Link to this section Callbacks

@callback arrange(df(), columns :: [colname() | {:asc | :desc, colname()}]) :: df()
@callback concat_rows([df()]) :: df()
Link to this callback

distinct(df, columns, keep_all?)

View Source
@callback distinct(df(), columns :: [colname()], keep_all? :: boolean()) :: df()
@callback drop_nil(df(), columns :: [colname()]) :: df()
@callback dtypes(df()) :: [String.t()]
@callback dummies(df(), columns :: [colname()]) :: df()
@callback filter(df(), mask :: series()) :: df()
@callback from_columns(map() | Keyword.t()) :: df()
@callback from_rows([map() | Keyword.t()]) :: df()
@callback group_by(df(), columns :: [colname()]) :: df()
@callback head(df(), rows :: integer()) :: df()
Link to this callback

join( left, right, on, how )

View Source
@callback join(
  left :: df(),
  right :: df(),
  on :: [String.t() | {String.t(), String.t()}],
  how :: :left | :inner | :outer | :right | :cross
) :: df()
Link to this callback

mutate(df, with_columns)

View Source
@callback mutate(df(), with_columns :: map()) :: df()
@callback n_cols(df()) :: integer()
@callback n_rows(df()) :: integer()
@callback names(df()) :: [colname()]
Link to this callback

pivot_longer( df, id_cols, value_cols, names_to, values_to )

View Source
@callback pivot_longer(
  df(),
  id_cols :: [colname()],
  value_cols :: [colname()],
  names_to :: colname(),
  values_to :: colname()
) :: df()
Link to this callback

pivot_wider( df, id_cols, names_from, values_from, names_prefix )

View Source
@callback pivot_wider(
  df(),
  id_cols :: [colname()],
  names_from :: [colname()],
  values_from :: [colname()],
  names_prefix :: String.t()
) :: df()
@callback pull(df(), column :: String.t()) :: series()
Link to this callback

read_csv( filename, names, dtypes, delimiter, null_character, skip_rows, header?, encoding, max_rows, with_columns, infer_schema_length, parse_dates )

View Source
@callback read_csv(
  filename :: String.t(),
  names :: [String.t()] | nil,
  dtypes :: [{String.t(), atom()}] | nil,
  delimiter :: String.t(),
  null_character :: String.t(),
  skip_rows :: integer(),
  header? :: boolean(),
  encoding :: String.t(),
  max_rows :: integer() | Inf,
  with_columns :: [String.t()] | nil,
  infer_schema_length :: integer() | nil,
  parse_dates :: boolean()
) :: result(df())
Link to this callback

read_ipc( filename, columns, projection )

View Source
@callback read_ipc(
  filename :: String.t(),
  columns :: [String.t()],
  projection :: [integer()]
) :: result(df())
Link to this callback

read_ndjson( filename, infer_schema_length, with_batch_size )

View Source
@callback read_ndjson(
  filename :: String.t(),
  infer_schema_length :: integer(),
  with_batch_size :: integer()
) :: result(df())
@callback read_parquet(filename :: String.t()) :: result(df())
@callback rename(df(), [colname()]) :: df()
Link to this callback

sample(df, n, with_replacement?, seed)

View Source
@callback sample(df(), n :: integer(), with_replacement? :: boolean(), seed :: integer()) ::
  df()
Link to this callback

select(df, columns, arg3)

View Source
@callback select(df(), columns :: [colname()], :keep | :drop) :: df()
@callback shape(df()) :: {integer(), integer()}
Link to this callback

slice(df, offset, length)

View Source
@callback slice(df(), offset :: integer(), length :: integer()) :: df()
Link to this callback

summarise(df, aggregations)

View Source
@callback summarise(df(), aggregations :: map()) :: df()
@callback tail(df(), rows :: integer()) :: df()
@callback take(df(), indices :: [integer()]) :: df()
Link to this callback

to_binary(df, header?, delimiter)

View Source
@callback to_binary(df(), header? :: boolean(), delimiter :: String.t()) :: String.t()
Link to this callback

to_map(df, convert_series?, atom_keys?)

View Source
@callback to_map(df(), convert_series? :: boolean(), atom_keys? :: boolean()) :: map()
@callback ungroup(df(), columns :: [colname()]) :: df()
Link to this callback

write_csv(df, filename, header?, delimiter)

View Source
@callback write_csv(
  df(),
  filename :: String.t(),
  header? :: boolean(),
  delimiter :: String.t()
) ::
  result(String.t())
Link to this callback

write_ipc(df, filename, compression)

View Source
@callback write_ipc(df(), filename :: String.t(), compression :: String.t()) ::
  result(String.t())
Link to this callback

write_ndjson(df, filename)

View Source
@callback write_ndjson(df(), filename :: String.t()) :: result(String.t())
Link to this callback

write_parquet(df, filename)

View Source
@callback write_parquet(df(), filename :: String.t()) :: result(String.t())