Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
phofl committed Feb 19, 2024
1 parent b5c6e9a commit 4fa3e86
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dask_expr/_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3486,15 +3486,15 @@ def determine_column_projection(expr, parent, dependents, additional_columns=Non
def _sort_mixed(values):
"""order ints before strings before nulls in 1d arrays"""
str_pos = np.array([isinstance(x, str) for x in values], dtype=bool)
tuple_pos = np.array([isinstance(x, str) for x in values], dtype=bool)
tuple_pos = np.array([isinstance(x, tuple) for x in values], dtype=bool)
null_pos = np.array([pd.isna(x) for x in values], dtype=bool)
num_pos = ~str_pos & ~null_pos & ~tuple_pos
str_argsort = np.argsort(values[str_pos])
tuple_argsort = np.argsort(values[tuple_pos])
num_argsort = np.argsort(values[num_pos])
# convert boolean arrays to positional indices, then order by underlying values
str_locs = str_pos.nonzero()[0].take(str_argsort)
tuple_locs = str_pos.nonzero()[0].take(tuple_argsort)
tuple_locs = tuple_pos.nonzero()[0].take(tuple_argsort)
num_locs = num_pos.nonzero()[0].take(num_argsort)
null_locs = null_pos.nonzero()[0]
locs = np.concatenate([num_locs, str_locs, tuple_locs, null_locs])
Expand Down

0 comments on commit 4fa3e86

Please sign in to comment.