Skip to content

Commit

Permalink
πŸ› Persist index uniqueness (#801)
Browse files Browse the repository at this point in the history
* πŸ”¨ Add "unique" key to be saved

* βœ… Update unit tests

* Update schema_inference.rst

Co-authored-by: Niels Bantilan <niels.bantilan@gmail.com>
  • Loading branch information
christeefy and cosmicBboy committed Apr 1, 2022
1 parent 20fd29a commit c0c2d40
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/source/schema_inference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ is a convenience method for this functionality.
greater_than_or_equal_to: 0.0
less_than_or_equal_to: 2.0
name: null
unique: false
coerce: false
coerce: true
strict: false
Expand Down
1 change: 1 addition & 0 deletions pandera/schema_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def _get_series_base_schema_statistics(series_schema_base):
"checks": parse_checks(series_schema_base.checks),
"coerce": series_schema_base.coerce,
"name": series_schema_base.name,
"unique": series_schema_base.unique,
}


Expand Down
3 changes: 3 additions & 0 deletions tests/core/test_schema_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ def test_get_dataframe_schema_statistics():
"nullable": False,
"coerce": False,
"name": "int_index",
"unique": False,
}
],
"coerce": False,
Expand Down Expand Up @@ -503,6 +504,7 @@ def test_get_series_schema_statistics():
},
"name": None,
"coerce": False,
"unique": False,
}


Expand All @@ -529,6 +531,7 @@ def test_get_series_schema_statistics():
},
"name": "int_index",
"coerce": False,
"unique": False,
}
],
]
Expand Down
1 change: 1 addition & 0 deletions tests/io/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def _create_schema(index="single"):
nullable: false
checks: null
name: null
unique: false
coerce: false
coerce: false
strict: true
Expand Down

0 comments on commit c0c2d40

Please sign in to comment.