Typed Wrappers over Pandas DataFrames with schema validation
Project description
typedframe
Typed Wrappers over Pandas DataFrames with schema validation.
>>> from typedframe import TypedDataFrame
>>> class MyTable(TypedDataFrame):
... schema = {
... "col1": object, # str
... "col2": np.int32,
... "col3": 'category'
... }
... optional = {
... "col4": bool,
"col5": np.dtype('datetime64[ns]')
... }
>>> df = pd.DataFrame({"col1": ['foo'], "col2": np.array([1], dtype=np.int32), "col3": ['bar']})
>>> df.col3 = df.col3.astype("category")
>>> print(MyTable(df).df)
Project details
Release history Release notifications | RSS feed
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.1.1.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for typedframe-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64f2071860aced11d9f05dfef19330812e454f1a8b777f7716d2c51a28d4817d |
|
MD5 | 33230b418dd01ae2339252a7226c14b0 |
|
BLAKE2b-256 | 03ad39ff1a5d2de974b589714ad898978527de1b81f87dbfc69dbb1baf4d9db6 |