Skip to content

Commit

Permalink
Add tokenize NA functionality (dask#10640)
Browse files Browse the repository at this point in the history
  • Loading branch information
phofl authored Nov 22, 2023
1 parent 204be6d commit da7dc67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dask/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,10 @@ def normalize_categorical_dtype(dtype):
def normalize_period_dtype(dtype):
return normalize_token(dtype.name)

@normalize_token.register(type(pd.NA))
def normalize_na(dtype):
return pd.NA


@normalize_token.register_lazy("numpy")
def register_numpy():
Expand Down
5 changes: 5 additions & 0 deletions dask/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,11 @@ def test_tokenize_pandas_extension_array():
assert tokenize(arr) == tokenize(arr)


@pytest.mark.skipif("not dd")
def test_tokenize_na():
assert tokenize(pd.NA) == tokenize(pd.NA)


@pytest.mark.skipif("not pd")
def test_tokenize_pandas_index():
idx = pd.Index(["a", "b"])
Expand Down

0 comments on commit da7dc67

Please sign in to comment.