Skip to content

Commit

Permalink
Adds strict keyword to yaml; addresses #218 (#219)
Browse files Browse the repository at this point in the history
* Adds strict keyword to yaml; addresses #218

* Still for #218; fix sphinxdoc inference

* A friendly helper for reminding to build the docs

Co-authored-by: Steve Taylor <stta9820@colorado.edu>
  • Loading branch information
staylorx and staylorx authored Jun 15, 2020
1 parent 3bf8e72 commit 3bd2655
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ each pull request:
Before submitting your changes for review, make sure to check that your changes
do not break any tests by running: ``pytest tests/``

Additionally, sphinxdocs may block you; make sure that the docs build successfully:
``python -m sphinx -E -W -b=doctest "docs/source" "docs/_build"``

### Raising Pull Requests

Once your changes are ready to be submitted, make sure to push your changes to
Expand Down
1 change: 1 addition & 0 deletions docs/source/schema_inference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ is a convenience method for this functionality.
less_than_or_equal_to: 2.0
name: null
coerce: true
strict: false

You can edit this yaml file by specifying column names under the ``column``
key. The respective values map onto key-word arguments in the
Expand Down
2 changes: 2 additions & 0 deletions pandera/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def _serialize_schema(dataframe_schema):
"columns": columns,
"index": index,
"coerce": dataframe_schema.coerce,
"strict": dataframe_schema.strict,
}


Expand Down Expand Up @@ -169,6 +170,7 @@ def _deserialize_schema(serialized_schema):
},
index=index,
coerce=serialized_schema["coerce"],
strict=serialized_schema["strict"],
)


Expand Down
5 changes: 4 additions & 1 deletion tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ def _create_schema(index="single"):
pa.Check.greater_than(pd.Timedelta(1000, unit="ns")),
pa.Check.less_than(pd.Timedelta(10000, unit="ns")),
]
)
),
},
index=index,
coerce=False,
strict=True
)


Expand Down Expand Up @@ -119,6 +121,7 @@ def _create_schema(index="single"):
checks: null
name: int_index
coerce: false
strict: true
""".format(version=pa.__version__)


Expand Down

0 comments on commit 3bd2655

Please sign in to comment.