View Source Explorer.Backend.DataFrame behaviour (Explorer v0.4.0)
The behaviour for DataFrame backends.
Link to this section Summary
Link to this section Types
@type basic_types() :: float() | integer() | String.t() | Date.t() | DateTime.t()
@type column_name() :: String.t()
@type columns_for_io() :: [column_name()] | [pos_integer()] | nil
@type df() :: Explorer.DataFrame.t()
@type dtype() :: Explorer.Series.dtype()
@type dtypes() :: %{required(column_name()) => dtype()}
@type lazy_frame() :: Explorer.Backend.LazyFrame.t()
@type lazy_series() :: Explorer.Backend.LazySeries.t()
@type mutate_value() :: series() | basic_types() | [basic_types()] | (df() -> series() | basic_types() | [basic_types()])
@type ok_result() :: :ok | {:error, term()}
@type result(t) :: {:ok, t} | {:error, term()}
@type series() :: Explorer.Series.t()
@type t() :: struct()
Link to this section Callbacks
@callback arrange_with( df(), out_df :: df(), directions :: [{:asc | :desc, lazy_series()}] ) :: df()
@callback distinct( df(), out_df :: df(), columns :: [column_name()], keep_all :: boolean() ) :: df()
@callback drop_nil(df(), columns :: [column_name()]) :: df()
@callback dummies(df(), out_df :: df(), columns :: [column_name()]) :: df()
@callback dump_ipc(df(), compression()) :: result(binary())
@callback dump_ipc_stream(df(), compression()) :: result(binary())
@callback dump_parquet(df(), compression()) :: result(binary())
@callback filter_with(df(), out_df :: df(), lazy_series()) :: df()
Link to this callback
from_csv( filename, dtypes, delimiter, null_character, skip_rows, header?, encoding, max_rows, columns, infer_schema_length, parse_dates )
View Source@callback from_csv( filename :: String.t(), dtypes :: [{column_name(), dtype()}], delimiter :: String.t(), null_character :: String.t(), skip_rows :: integer(), header? :: boolean(), encoding :: String.t(), max_rows :: integer() | nil, columns :: columns_for_io(), infer_schema_length :: integer() | nil, parse_dates :: boolean() ) :: result(df())
@callback from_ipc( filename :: String.t(), columns :: columns_for_io() ) :: result(df())
@callback from_ipc_stream( filename :: String.t(), columns :: columns_for_io() ) :: result(df())
@callback from_tabular(Table.Reader.t()) :: df()
@callback inspect(df(), opts :: Inspect.Opts.t()) :: Inspect.Algebra.t()
@callback join( left :: df(), right :: df(), out_df :: df(), on :: [{column_name(), column_name()}], how :: :left | :inner | :outer | :right | :cross ) :: df()
@callback lazy() :: module()
Link to this callback
load_csv( contents, dtypes, delimiter, null_character, skip_rows, header?, encoding, max_rows, columns, infer_schema_length, parse_dates )
View Source@callback load_csv( contents :: String.t(), dtypes :: [{column_name(), dtype()}], delimiter :: String.t(), null_character :: String.t(), skip_rows :: integer(), header? :: boolean(), encoding :: String.t(), max_rows :: integer() | nil, columns :: columns_for_io(), infer_schema_length :: integer() | nil, parse_dates :: boolean() ) :: result(df())
@callback load_ipc( contents :: binary(), columns :: columns_for_io() ) :: result(df())
@callback load_ipc_stream( contents :: binary(), columns :: columns_for_io() ) :: result(df())
@callback mutate_with(df(), out_df :: df(), mutations :: [{column_name(), lazy_series()}]) :: df()
Link to this callback
pivot_longer(df, out_df, columns_to_pivot, columns_to_keep, names_to, values_to)
View Source@callback pivot_longer( df(), out_df :: df(), columns_to_pivot :: [column_name()], columns_to_keep :: [column_name()], names_to :: column_name(), values_to :: column_name() ) :: df()
Link to this callback
pivot_wider(df, out_df, id_columns, names_from, values_from, names_prefix)
View Source@callback pivot_wider( df(), out_df :: df(), id_columns :: [column_name()], names_from :: column_name(), values_from :: column_name(), names_prefix :: String.t() ) :: df()
@callback pull(df(), column :: column_name()) :: series()
@callback put(df(), out_df :: df(), column_name(), series()) :: df()
@callback rename(df(), out_df :: df(), [{old :: column_name(), new :: column_name()}]) :: df()
@callback summarise_with( df(), out_df :: df(), aggregations :: [{column_name(), lazy_series()}] ) :: df()
@callback to_ipc(df(), filename :: String.t(), compression()) :: ok_result()
@callback to_ipc_stream( df(), filename :: String.t(), compression() ) :: ok_result()
@callback to_parquet( df(), filename :: String.t(), compression() ) :: ok_result()
Link to this section Functions
Default inspect implementation for backends.
Creates a new DataFrame for a given backend.