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

Function _maybe_sort

dask/dataframe/utils.py:495–510  ·  view source on GitHub ↗
(a, check_index: bool)

Source from the content-addressed store, hash-verified

493
494
495def _maybe_sort(a, check_index: bool):
496 import dask.dataframe.methods as methods
497
498 # sort by value, then index
499 try:
500 if is_dataframe_like(a):
501 if set(a.index.names) & set(a.columns):
502 a.index.names = [
503 "-overlapped-index-name-%d" % i for i in range(len(a.index.names))
504 ]
505 a = a.sort_values(by=methods.tolist(a.columns))
506 else:
507 a = a.sort_values()
508 except (TypeError, IndexError, ValueError):
509 pass
510 return a.sort_index() if check_index else a
511
512
513def _maybe_convert_string(a, b):

Callers 1

assert_eqFunction · 0.85

Calls 3

is_dataframe_likeFunction · 0.90
setClass · 0.85
sort_valuesMethod · 0.80

Tested by

no test coverage detected