tstore.tslong package#

Submodules#

tstore.tslong.dask module#

Module defining the TSLongDask wrapper.

class tstore.tslong.dask.TSLongDask(*args, **kwargs)[source]#

Bases: TSLong

Wrapper for a long-form Dask timeseries dataframe.

static from_tstore(base_dir, ts_variables=None, start_time=None, end_time=None, inclusive=None, tstore_ids=None, columns=None, filesystem=None, use_threads=True) TSLongDask[source]#

Open a TStore file structure as a TSLongDask wrapper around a Pandas long dataframe.

to_tsdf() TSDF[source]#

Convert the wrapper into a TSDF object with Dask TS objects.

to_tstore(base_dir, partitioning=None, tstore_structure='id-var', overwrite=True)[source]#

Write the wrapped dataframe as a TStore structure.

to_tswide() TSWideDask[source]#

Convert the wrapper into a TSWideDask object.

tstore.tslong.pandas module#

Module defining the TSLongPandas wrapper.

class tstore.tslong.pandas.TSLongPandas(*args, **kwargs)[source]#

Bases: TSLong

Wrapper for a long-form Pandas timeseries dataframe.

static from_tstore(base_dir, ts_variables=None, start_time=None, end_time=None, inclusive=None, tstore_ids=None, columns=None, filesystem=None, use_threads=True) TSLongPandas[source]#

Open a TStore file structure as a TSLongPandas wrapper around a Pandas long dataframe.

to_tstore(base_dir, partitioning=None, tstore_structure='id-var', overwrite=True)[source]#

Write the wrapped dataframe as a TStore structure.

to_tswide() TSWidePandas[source]#

Convert the wrapper into a TSWide object.

tstore.tslong.polars module#

Module defining the TSLongPolars wrapper.

class tstore.tslong.polars.TSLongPolars(*args, **kwargs)[source]#

Bases: TSLong

Wrapper for a long-form Polars timeseries dataframe.

static from_tstore(base_dir, ts_variables=None, start_time=None, end_time=None, inclusive=None, tstore_ids=None, columns=None, filesystem=None, use_threads=True) TSLongPolars[source]#

Open a TStore file structure as a TSLongPolar wrapper around a Polar long dataframe.

to_tstore(base_dir, partitioning=None, tstore_structure='id-var', overwrite=True) None[source]#

Write the wrapped dataframe as a TStore structure.

tstore.tslong.pyarrow module#

Module defining the TSLongPyArrow wrapper.

class tstore.tslong.pyarrow.TSLongPyArrow(*args, **kwargs)[source]#

Bases: TSLong

Wrapper for a long-form PyArrow timeseries dataframe.

static from_tstore(base_dir, ts_variables=None, start_time=None, end_time=None, inclusive=None, tstore_ids=None, columns=None, filesystem=None, use_threads=True) TSLongPyArrow[source]#

Open a TStore file structure as a TSLongPyArrow wrapper around a Pandas long dataframe.

to_tstore(base_dir, partitioning=None, tstore_structure='id-var', overwrite=True)[source]#

Write the wrapped dataframe as a TStore structure.

tstore.tslong.tslong module#

Module defining the TSLong abstract wrapper.

class tstore.tslong.tslong.TSLong(*args, **kwargs)[source]#

Bases: TSWrapper

Abstract wrapper for a long-form timeseries DataFrame.

change_backend(new_backend: Literal['dask', 'geopandas', 'pandas', 'polars', 'pyarrow']) TSLong[source]#

Return a new wrapper with the dataframe converted to a different backend.

to_tsdf() TSDF[source]#

Convert the wrapper into a TSDF object.

to_tswide() TSWide[source]#

Convert the wrapper into a TSWide object.

static wrap(self, df: DataFrame | GeoDataFrame | DataFrame | DataFrame | Table, id_var: str, time_var: str = 'time', ts_vars: dict[str, list[str]] | list[str] | None = None, static_vars: list[str] | None = None, geometry: GeoDataFrame | None = None) TSLong[source]#

Wrap a long-form timeseries DataFrame as a TSLong object.

Parameters:
  • df (DataFrame) – DataFrame to wrap.

  • id_var (str) – Name of the column containing the identifier variable.

  • time_var (str) – Name of the column containing the time variable. Defaults to “time”.

  • ts_vars (Union[dict[str, list[str]], list[str], None]) – Dictionary of named groups of column names or list of column names (which will create one group per entry). Defaults to None, which will group all columns not in static_vars together under a group called “ts_variable”.

  • static_vars (Optional[list[str]]) – List of column names that are static across time. Defaults to None.

  • geometry (Optional[GeoPandasDataFrame]) – GeoPandas DataFrame containing geometry information for each id. Defaults to None.

Module contents#

TSLong package.

class tstore.tslong.TSLong(*args, **kwargs)[source]#

Bases: TSWrapper

Abstract wrapper for a long-form timeseries DataFrame.

change_backend(new_backend: Literal['dask', 'geopandas', 'pandas', 'polars', 'pyarrow']) TSLong[source]#

Return a new wrapper with the dataframe converted to a different backend.

to_tsdf() TSDF[source]#

Convert the wrapper into a TSDF object.

to_tswide() TSWide[source]#

Convert the wrapper into a TSWide object.

static wrap(self, df: DataFrame | GeoDataFrame | DataFrame | DataFrame | Table, id_var: str, time_var: str = 'time', ts_vars: dict[str, list[str]] | list[str] | None = None, static_vars: list[str] | None = None, geometry: GeoDataFrame | None = None) TSLong[source]#

Wrap a long-form timeseries DataFrame as a TSLong object.

Parameters:
  • df (DataFrame) – DataFrame to wrap.

  • id_var (str) – Name of the column containing the identifier variable.

  • time_var (str) – Name of the column containing the time variable. Defaults to “time”.

  • ts_vars (Union[dict[str, list[str]], list[str], None]) – Dictionary of named groups of column names or list of column names (which will create one group per entry). Defaults to None, which will group all columns not in static_vars together under a group called “ts_variable”.

  • static_vars (Optional[list[str]]) – List of column names that are static across time. Defaults to None.

  • geometry (Optional[GeoPandasDataFrame]) – GeoPandas DataFrame containing geometry information for each id. Defaults to None.

tstore.tslong.open_tslong(base_dir: str | Path, *args, backend: Literal['dask', 'geopandas', 'pandas', 'polars', 'pyarrow'] = 'dask', **kwargs)[source]#

Read a TStore file structure as a TSLong object.