(a, check_index: bool)
| 490 | |
| 491 | |
| 492 | def _maybe_sort(a, check_index: bool): |
| 493 | from dask.dataframe import methods |
| 494 | |
| 495 | # sort by value, then index |
| 496 | try: |
| 497 | if is_dataframe_like(a): |
| 498 | if set(a.index.names) & set(a.columns): |
| 499 | a.index.names = [ |
| 500 | f"-overlapped-index-name-{i}" for i in range(len(a.index.names)) |
| 501 | ] |
| 502 | a = a.sort_values(by=methods.tolist(a.columns)) |
| 503 | else: |
| 504 | a = a.sort_values() |
| 505 | except (TypeError, IndexError, ValueError): |
| 506 | pass |
| 507 | return a.sort_index() if check_index else a |
| 508 | |
| 509 | |
| 510 | def _maybe_convert_string(a, b): |
no test coverage detected