MCPcopy Create free account
hub / github.com/dask/dask / normalize_index

Function normalize_index

dask/tokenize.py:289–305  ·  view source on GitHub ↗
(ind)

Source from the content-addressed store, hash-verified

287
288 @normalize_token.register(pd.Index)
289 def normalize_index(ind):
290 values = ind.array
291
292 if isinstance(values, pd.arrays.ArrowExtensionArray):
293 import pyarrow as pa
294
295 # these are sensitive to fragmentation of the backing Arrow array.
296 # Because common operations like DataFrame.getitem and DataFrame.setitem
297 # result in fragmented Arrow arrays, we'll consolidate them here.
298
299 if PANDAS_GE_210:
300 # avoid combining chunks by using chunked_array
301 values = pa.chunked_array([values._pa_array]).combine_chunks()
302 else:
303 values = pa.array(values)
304
305 return type(ind), ind.name, normalize_token(values)
306
307 @normalize_token.register(pd.MultiIndex)
308 def normalize_index(ind):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected