strictly_typed_pandas.DataSet

class strictly_typed_pandas.DataSet(*args, **kwargs)

DataSet allows for static type checking of pandas DataFrames, for example:

class Schema:
    a: int

DataSet[Schema]({"a": [1, 2, 3]})
Where DataSet:
  • is a subclass of pd.DataFrame and hence has the same functionality as DataFrame.

  • validates whether the data adheres to the provided schema upon its initialization.

  • is immutable, so its schema cannot be changed using inplace modifications.

The DataSet[Schema] annotations are compatible with:
  • mypy for type checking during linting-time (i.e. while you write your code).

  • typeguard (<3.0) for type checking during run-time (i.e. while you run your unit tests).

__init__(*args, **kwargs)
to_dataframe() DataFrame

Converts the object to a pandas DataFrame.

to_frame() DataFrame

Synonym of to to_dataframe(): converts the object to a pandas DataFrame.