Skip to content

Commit c008162

Browse files
committed
Much nicer normalize_token for pd.RangeIndex
1 parent b77305c commit c008162

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

flox/dask_array_ops.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@
44
from itertools import product
55
from numbers import Integral
66

7+
import pandas as pd
78
from dask import config
9+
from dask.base import normalize_token
810
from dask.blockwise import lol_tuples
911
from toolz import partition_all
1012

1113
from .lib import ArrayLayer
1214
from .types import Graph
1315

1416

17+
# workaround for https://github.com/dask/dask/issues/11862
18+
@normalize_token.register(pd.RangeIndex)
19+
def normalize_range_index(x):
20+
return normalize_token(type(x)), x.start, x.stop, x.step, x.dtype, x.name
21+
22+
1523
# _tree_reduce and partial_reduce are copied from dask.array.reductions
1624
# They have been modified to work purely with graphs, and without creating new Array layers
1725
# in the graph. The `block_index` kwarg is new and avoids a concatenation by simply setting the right

0 commit comments

Comments
 (0)