Registry / data / datashape

datashape

JSON →
library0.5.2pypypiunverified

A data description language for describing and validating the structure of tabular and array data. Current version is 0.5.2. The library is in maintenance mode; no active development expected.

pip install datashape==0.5.2
INSTALL
IMPORT
SIG · DATASHAPE
D
datashape
datapythonv0.5.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DataShape
from datashape import DataShape
import datashape.DataShape
DataShape is a class in the top-level module, not a submodule.
dshape
from datashape import dshape
from datashape.predicates import dshape
dshape is a function in the top-level module, not in predicates.

Define a data shape and validate a numpy array against it.

from datashape import dshape, DataShape # Define a simple shape ds = dshape('3 * int32') print(ds) # Validate data import numpy as np arr = np.array([1, 2, 3], dtype=np.int32) result = ds.match(arr) print(result)
Debug
Known issues
breakingThe 'var' syntax for variable-length dimensions changed in 0.5.0. Previously 'var' was used directly, now it must be written as 'var * type'.
fix
Update shape strings to use 'var * type', e.g., 'var * int32' instead of 'var int32'.
affects: <0.5.0
deprecatedThe 'datashape.predicates' module is deprecated and may be removed in a future version. Use top-level functions like 'isrecord', 'isscalar', etc., from 'datashape' directly.
fix
Replace 'from datashape.predicates import isrecord' with 'from datashape import isrecord'.
affects: >=0.5.0
gotchaDataShape's 'match()' method returns a boolean, not a validation report. It may raise TypeError if the data type is incompatible.
fix
Wrap match() in a try-except block for type validation, or use 'validate()' method if available (not in 0.5.2).
affects: all
Upgrade
Version history
0.5.2latest on PyPI · released Apr 25, 2016
Audit
Dependencies
numpyrequiredRequired for array type support.
multipledispatchrequiredUsed for dispatch in type promotions.
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
datashape — pip install datashape · libregistry