Skip to content

Commit 1dc0f80

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

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

flox/dask_array_ops.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,21 @@
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+
@normalize_token.register(pd.RangeIndex)
18+
def normalize_range_index(x):
19+
return normalize_token(type(x)), x.start, x.stop, x.step, x.dtype, x.name
20+
21+
1522
# _tree_reduce and partial_reduce are copied from dask.array.reductions
1623
# They have been modified to work purely with graphs, and without creating new Array layers
1724
# in the graph. The `block_index` kwarg is new and avoids a concatenation by simply setting the right

0 commit comments

Comments
 (0)