TSMultipleReader#

class anomalearn.reader.time_series.TSMultipleReader.TSMultipleReader#

Bases: TSReader, IDataMultipleReader

A time series reader able to read multiple data series at the same time.

This class is able to read multiple data series in a single call. The time series might be from the same dataset as well they might be from different datasets.

Inherited attributes

accepted_formats#

List of methods

get_all_dataframes(*args, **kwargs)

Gets all the dataframes previously read.

get_ith_dataframe(pos, *args, **kwargs)

Get the ith dataframe in all the read ones.

read_multiple(paths[, files_format, pandas_args])

Reads multiple datasets at the same time.

select_dataframe(pos)

Selects the dataset to be used.

List of inherited methods

get_dataframe(*args, **kwargs)

Gets the dataframe of the dataset previously read.

read(path[, file_format, pandas_args])

Reads a dataset and returns an instance of itself.

List of inherited decorated methods

get_dataframe(*args, **kwargs)

Gets the dataframe of the dataset previously read.

read(path[, file_format, pandas_args])

Reads a dataset and returns an instance of itself.

Methods

get_all_dataframes(*args, **kwargs) list[pandas.core.frame.DataFrame]#

Gets all the dataframes previously read.

Parameters:
  • args – Not used, present to allow multiple inheritance and signature change.

  • kwargs – Not used, present to allow multiple inheritance and signature change.

Returns:

dataframes – All the dataframes in the same order specified with read_multiple.

Return type:

list[DataFrame]

Raises:

ValueError – If the datasets have not been read.

get_ith_dataframe(pos: int, *args, **kwargs) DataFrame#

Get the ith dataframe in all the read ones.

Parameters:
  • pos (int) – The position of the dataframe to be read.

  • args – Not used, present to allow multiple inheritance and signature change.

  • kwargs – Not used, present to allow multiple inheritance and signature change.

Returns:

dataframe – The ith dataframe in the order specified with read_multiple.

Return type:

DataFrame

Raises:
read_multiple(paths: list[str], files_format: str = 'csv', pandas_args: dict | None = None, *args, **kwargs) TSMultipleReader#

Reads multiple datasets at the same time.

Parameters:
  • paths (str) – It is a list of strings representing the paths at which the datasets to read are stored.

  • files_format (str, default="csv") – It is the format in which the datasets are stored.

  • pandas_args (dict or None) – This dict represent all the additional params to be used while reading the dataset with pandas. The params depend on the file format of the dataset. If the format is “csv”, the additional params will be the pandas params for read_csv and so on.

  • verbose (bool, default=True) – States if detailed printing must be done while reading the dataset.

  • args – Not used, present to allow multiple inheritance and signature change.

  • kwargs – Not used, present to allow multiple inheritance and signature change.

Returns:

Instance of itself to be able to chain calls.

Return type:

IDataMultipleReader

Raises:

NotImplementedError – If the file format is not supported.

select_dataframe(pos: int) TSMultipleReader#

Selects the dataset to be used.

Parameters:

pos (int) – The dataset to select to perform single dataset operations.

Returns:

Instance to itself to allow call chaining.

Return type:

self

Raises:

Inherited methods

get_dataframe(*args, **kwargs) DataFrame#

Gets the dataframe of the dataset previously read.

Parameters:
  • args – Not used, present to allow multiple inheritance and signature change.

  • kwargs – Not used, present to allow multiple inheritance and signature change.

Returns:

dataframe – The dataframe of the dataset.

Return type:

DataFrame

Raises:

ValueError – If the dataset has not been read.

read(path, file_format: str = 'csv', pandas_args: dict | None = None, *args, **kwargs) TSReader#

Reads a dataset and returns an instance of itself.

When the dataset is read, a dataframe to represent the dataset is built to represent it.

Parameters:
  • path – It is a path representing the location on disk of the dataset to read.

  • file_format (["csv", "json"]) – It is the format in which the dataset is stored.

  • pandas_args (dict or None) – This dict represent all the additional params to be used while reading the dataset with pandas. The params depend on the file format of the dataset. If the format is “csv”, the additional params will be the pandas params for read_csv and so on.

  • args – Not used, present to allow multiple inheritance and signature change.

  • kwargs – Not used, present to allow multiple inheritance and signature change.

Returns:

Instance of itself to be able to chain calls.

Return type:

IDataReader

Raises:

NotImplementedError – If the file format is not supported.

Inherited decorated methods

get_dataframe(*args, **kwargs) DataFrame#

Gets the dataframe of the dataset previously read.

Parameters:
  • args – Not used, present to allow multiple inheritance and signature change.

  • kwargs – Not used, present to allow multiple inheritance and signature change.

Returns:

dataframe – The dataframe of the dataset.

Return type:

DataFrame

Raises:

ValueError – If the dataset has not been read.

read(path, file_format: str = 'csv', pandas_args: dict | None = None, *args, **kwargs) TSReader#

Reads a dataset and returns an instance of itself.

When the dataset is read, a dataframe to represent the dataset is built to represent it.

Parameters:
  • path – It is a path representing the location on disk of the dataset to read.

  • file_format (["csv", "json"]) – It is the format in which the dataset is stored.

  • pandas_args (dict or None) – This dict represent all the additional params to be used while reading the dataset with pandas. The params depend on the file format of the dataset. If the format is “csv”, the additional params will be the pandas params for read_csv and so on.

  • args – Not used, present to allow multiple inheritance and signature change.

  • kwargs – Not used, present to allow multiple inheritance and signature change.

Returns:

Instance of itself to be able to chain calls.

Return type:

IDataReader

Raises:

NotImplementedError – If the file format is not supported.