Skip to main content

Typed Wrappers over Pandas DataFrames with schema validation

Project description

🐍 typedframe

Typed wrappers over pandas DataFrames with schema validation.

TypedDataFrame is a lightweight wrapper over pandas.DataFrame that provides runtime schema validation and can be used to establish strong data contracts between interfaces in your Python code.

    >>> from typedframe import TypedDataFrame, DATE_TIME_DTYPE
    >>> class MyTable(TypedDataFrame):
    ...    schema = {
    ...        "col1": object, # str
    ...        "col2": np.int32,
    ...        "col3": ('foo', 'bar')
    ...    }
    ...    optional = {
    ...        "col4": bool,
               "col5": DATE_TIME_DTYPE
    ...    }

    >>> df = pd.DataFrame({"col1": ['foo'], "col2": np.array([1], dtype=np.int32), "col3": ['bar']})
    >>> df.col3 = pd.Categorical(df.col3, categories=('foo', 'bar'), ordered=True)
    >>> print(MyTable(df).df)

Supported Data Types

  • Integers: np.int16, np.int32, np.int64, etc.
  • Floats: np.float16, np.float32, np.float64, etc.
  • Boolean: bool
  • String: STRING_DTYPE
  • Python object: object
  • Categorical: category
  • Date, Datetime: DATE_TIME_DTYPE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

typedframe-0.5.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

typedframe-0.5.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file typedframe-0.5.0.tar.gz.

File metadata

  • Download URL: typedframe-0.5.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.6

File hashes

Hashes for typedframe-0.5.0.tar.gz
Algorithm Hash digest
SHA256 60ca611f9c8fa67f27890d3cc51f658068530331bffc3828d225bef55026d5c1
MD5 9539f830e1eef61b83a7645276e6d920
BLAKE2b-256 a73fa9422bc3b246cbf8d6e530c721085d3604da2fc646d8d6698d8d73f43fa5

See more details on using hashes here.

File details

Details for the file typedframe-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: typedframe-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.6

File hashes

Hashes for typedframe-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df9ef2d7e5a78af1b513f7bd212a17a3b3480c62314412c8e8fe81e3ec5a41a2
MD5 9e4b3e00721b2943d07cf3334a16bb4c
BLAKE2b-256 6ef094aaa438a19d93a1364835b65c0be66f64376fe257468e9dd74f8d3249ce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page