Skip to content

Commit

Permalink
DOC: utils.hash() can change with pandas>=2.2 (#442)
Browse files Browse the repository at this point in the history
* DOC: utils.hash() can change with pandas>=2.2

* Fix rebasing
  • Loading branch information
hagenw authored Jun 25, 2024
1 parent 642984d commit fe8d090
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
6 changes: 6 additions & 0 deletions audformat/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,12 @@ def hash(
independent of the ordering of the elements,
and level or column names.
.. warning::
If ``obj`` is a dataframe or series
with data type ``"Int64"``,
the returned hash value changes with ``pandas>=2.2.0``.
Args:
obj: object
Expand Down
44 changes: 44 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,50 @@ def test_expand_file_path(tmpdir, index, root, expected):
pd.DataFrame([0, 1], columns=["name"]),
"-7179254265801896228",
),
pytest.param(
pd.DataFrame(
[0, 1, 2],
pd.Index([0, 1, 2], dtype="Int64"),
),
"5440931770055407318",
marks=pytest.mark.skipif(
pd.__version__ >= "2.2.0",
reason="Changed in pandas 2.2.0",
),
),
pytest.param(
pd.DataFrame(
[0, 1, 2],
pd.Index([0, 1, 2], dtype="Int64"),
),
"-5491649331962632325",
marks=pytest.mark.skipif(
pd.__version__ < "2.2.0",
reason="Changed in pandas 2.2.0",
),
),
pytest.param(
pd.Series(
[0, 1, 2],
pd.Index([0, 1, 2], dtype="Int64"),
),
"5440931770055407318",
marks=pytest.mark.skipif(
pd.__version__ >= "2.2.0",
reason="Changed in pandas 2.2.0",
),
),
pytest.param(
pd.Series(
[0, 1, 2],
pd.Index([0, 1, 2], dtype="Int64"),
),
"-5491649331962632325",
marks=pytest.mark.skipif(
pd.__version__ < "2.2.0",
reason="Changed in pandas 2.2.0",
),
),
],
)
def test_hash(obj, expected):
Expand Down

0 comments on commit fe8d090

Please sign in to comment.