Skip to content

Commit 79bcfb2

Browse files
committed
add polars LazyFrame generic type, element-wise checks, add docs (#1521)
* add polars LazyFrame generic type, add docs Signed-off-by: cosmicBboy <[email protected]> * readme, makefile fixes Signed-off-by: cosmicBboy <[email protected]> * add support for pl.DataFrame Signed-off-by: cosmicBboy <[email protected]> * fix failure case collection logic Signed-off-by: cosmicBboy <[email protected]> * update docs Signed-off-by: cosmicBboy <[email protected]> * add custom check docs Signed-off-by: cosmicBboy <[email protected]> * add polars elementwise check support Signed-off-by: cosmicBboy <[email protected]> * update docs Signed-off-by: cosmicBboy <[email protected]> * add NotImplementedError for polars strategies Signed-off-by: cosmicBboy <[email protected]> * update docs Signed-off-by: cosmicBboy <[email protected]> --------- Signed-off-by: cosmicBboy <[email protected]>
1 parent ff46a36 commit 79bcfb2

29 files changed

+2630
-1604
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ requirements:
2121
pip install -r requirements-dev.txt
2222

2323
docs-clean:
24-
rm -rf docs/**/generated docs/**/methods docs/_build docs/source/_contents
24+
rm -rf docs/source/reference/generated docs/**/generated docs/**/methods docs/_build docs/source/_contents
2525

2626
docs: docs-clean
27-
python -m sphinx -E "docs/source" "docs/_build" && make -C docs doctest
27+
python -m sphinx -W -E "docs/source" "docs/_build" && make -C docs doctest
2828

2929
quick-docs:
3030
python -m sphinx -E "docs/source" "docs/_build" -W && \

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ This is useful in production-critical or reproducible research settings. With
4242

4343
1. Define a schema once and use it to validate
4444
[different dataframe types](https://pandera.readthedocs.io/en/stable/supported_libraries.html)
45-
including [pandas](http://pandas.pydata.org), [dask](https://dask.org),
46-
[modin](https://modin.readthedocs.io/), and [pyspark](https://spark.apache.org/docs/3.2.0/api/python/user_guide/pandas_on_spark/index.html).
45+
including [pandas](http://pandas.pydata.org), [polars](https://docs.pola.rs/),
46+
[dask](https://dask.org), [modin](https://modin.readthedocs.io/),
47+
and [pyspark](https://spark.apache.org/docs/3.2.0/api/python/user_guide/pandas_on_spark/index.html).
4748
1. [Check](https://pandera.readthedocs.io/en/stable/checks.html) the types and
4849
properties of columns in a `DataFrame` or values in a `Series`.
4950
1. Perform more complex statistical validation like
@@ -100,6 +101,7 @@ pip install pandera[modin] # validate modin dataframes
100101
pip install pandera[modin-ray] # validate modin dataframes with ray
101102
pip install pandera[modin-dask] # validate modin dataframes with dask
102103
pip install pandera[geopandas] # validate geopandas geodataframes
104+
pip install pandera[polars] # validate polars dataframes
103105
```
104106

105107
</details>
@@ -120,6 +122,7 @@ conda install -c conda-forge pandera-modin # validate modin dataframes
120122
conda install -c conda-forge pandera-modin-ray # validate modin dataframes with ray
121123
conda install -c conda-forge pandera-modin-dask # validate modin dataframes with dask
122124
conda install -c conda-forge pandera-geopandas # validate geopandas geodataframes
125+
conda install -c conda-forge pandera-polars # validate polars dataframes
123126
```
124127

125128
</details>

docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
# documentation.
133133

134134
announcement = """
135-
📢 Pandera 0.16.0 now supports <a href="pyspark_sql.html">Pyspark SQL</a> 🎉.
135+
📢 Pandera 0.19.0 now supports <a href="/polars.html">Polars</a> 🎉.
136136
If you like this project, <a href='https://github.com/unionai-oss/pandera' target='_blank'>give us a star ⭐️! </a>
137137
"""
138138

docs/source/dataframe_models.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ As you can see in the examples above, you can define a schema by sub-classing
9494
The :func:`~pandera.decorators.check_types` decorator is required to perform validation of the dataframe at
9595
run-time.
9696

97-
Note that :class:`~pandera.api.pandas.model_components.Field` s apply to both
97+
Note that :class:`~pandera.api.dataframe.model_components.Field` s apply to both
9898
:class:`~pandera.api.pandas.components.Column` and :class:`~pandera.api.pandas.components.Index`
9999
objects, exposing the built-in :class:`Check` s via key-word arguments.
100100

@@ -714,7 +714,7 @@ Column/Index checks
714714
* Similarly to ``pydantic``, :func:`classmethod` decorator is added behind the scenes
715715
if omitted.
716716
* You still may need to add the ``@classmethod`` decorator *after* the
717-
:func:`~pandera.api.pandas.model_components.check` decorator if your static-type checker or
717+
:func:`~pandera.api.dataframe.model_components.check` decorator if your static-type checker or
718718
linter complains.
719719
* Since ``checks`` are class methods, the first argument value they receive is a
720720
DataFrameModel subclass, not an instance of a model.
@@ -830,7 +830,7 @@ Aliases
830830
-------
831831

832832
:class:`~pandera.api.pandas.model.DataFrameModel` supports columns which are not valid python variable names via the argument
833-
`alias` of :class:`~pandera.api.pandas.model_components.Field`.
833+
`alias` of :class:`~pandera.api.dataframe.model_components.Field`.
834834

835835
Checks must reference the aliased names.
836836

@@ -878,7 +878,7 @@ the class scope, and it will respect the alias.
878878
.. note::
879879

880880
To access a variable from the class scope, you need to make it a class attribute,
881-
and therefore assign it a default :class:`~pandera.api.pandas.model_components.Field`.
881+
and therefore assign it a default :class:`~pandera.api.dataframe.model_components.Field`.
882882

883883
.. testcode:: dataframe_schema_model
884884

docs/source/dtype_validation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ express this same type with the class-based API, we need to use an
123123
dt: Series[Annotated[pd.DatetimeTZDtype, "ns", "UTC"]]
124124

125125
Or alternatively, you can pass in the ``dtype_kwargs`` into
126-
:py:func:`~pandera.api.pandas.model_components.Field`:
126+
:py:func:`~pandera.api.dataframe.model_components.Field`:
127127

128128
.. testcode:: dtype_validation
129129

docs/source/index.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ This is useful in production-critical data pipelines or reproducible research
7878
settings. With ``pandera``, you can:
7979

8080
#. Define a schema once and use it to validate :ref:`different dataframe types <supported-dataframe-libraries>`
81-
including `pandas <http://pandas.pydata.org>`_, `dask <https://dask.org/>`_,
81+
including `pandas <http://pandas.pydata.org>`_, `polars <https://docs.pola.rs/>`, `dask <https://dask.org/>`_,
8282
`modin <https://modin.readthedocs.io/>`_, and
8383
`pyspark.pandas <https://spark.apache.org/docs/3.2.0/api/python/user_guide/pandas_on_spark/index.html>`_.
8484
#. :ref:`Check<checks>` the types and properties of columns in a
@@ -137,6 +137,7 @@ Installing additional functionality:
137137
pip install pandera[modin-ray] # validate modin dataframes with ray
138138
pip install pandera[modin-dask] # validate modin dataframes with dask
139139
pip install pandera[geopandas] # validate geopandas geodataframes
140+
pip install pandera[polars] # validate polars dataframes
140141
141142
.. tabbed:: conda
142143

@@ -153,6 +154,7 @@ Installing additional functionality:
153154
conda install -c conda-forge pandera-modin-ray # validate modin dataframes with ray
154155
conda install -c conda-forge pandera-modin-dask # validate modin dataframes with dask
155156
conda install -c conda-forge pandera-geopandas # validate geopandas geodataframes
157+
conda install -c conda-forge pandera-polars # validate polars dataframes
156158
157159
Quick Start
158160
-----------

docs/source/koalas.rst

-11
This file was deleted.

0 commit comments

Comments
 (0)