A utility library for working with Table Schema in Python, enabling validation, inference, and manipulation of tabular data based on the Table Schema standard. It is actively maintained with frequent releases, currently at version 1.21.0. An important notice indicates that the broader Frictionless Framework offers a more complete data solution, extending `tableschema`'s functionality.
pip install tableschemaVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a `Table` with data and a schema, iterate through its rows, and infer a schema from raw data. It creates temporary `data.csv` and `schema.json` files to provide a runnable example.
Review the `v1.0` migration guide and update API calls and parameter usage according to the new patterns. It is highly recommended to pin version ranges (e.g., `tableschema>=1.0,<2.0`) to avoid unexpected major version updates.
For new projects or if advanced data management features are needed, explore migrating to or directly using the Frictionless Framework for a more comprehensive solution. Existing `tableschema` implementations should continue to work as expected.
To validate data against a schema, load the data using `Table` with a specified `schema` and then iterate through the data. Validation errors will be raised during iteration if the data does not conform to the schema (especially in strict mode). Use `Table.iter()` which handles casting and validation.
Always specify a version range for `tableschema` in your `requirements.txt` or `setup.py` (e.g., `tableschema>=1.0,<2.0`) to ensure predictable dependency behavior and prevent automatic upgrades to potentially breaking major versions.
Install the package using pip: `pip install tableschema`
Correct the data type in the source data, modify the field's `type` in the schema to match the data, or implement data conversion before validation.
To validate data against a schema, first create a `Table` object with the data and schema, then use `table.validate()`.
Ensure the input provided to `tableschema.Schema()` is a valid schema dictionary, JSON string, or file path.