IDatasetReader#

class anomalearn.reader.IDatasetReader.IDatasetReader#

Bases: IDataReader, ObtainableABC

Abstract class for all dataset readers.

A dataset reader should implement this class if it is to be considered a data reader.

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.

Inherited decorated methods

abstract 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.

abstract read(path, file_format: str, pandas_args: dict | None = None, *args, **kwargs) IDataReader#

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.