Nixtla / utilsforecast

https://nixtlaverse.nixtla.io/utilsforecast
Apache License 2.0
42 stars 6 forks source link

improve sorting when ids are strings #82

Closed jmoralez closed 5 months ago

jmoralez commented 5 months ago

In #79 np.lexsort was preferred over pd.MultiIndex.argsort because it was faster. However, this isn't the case for large strings, so this chooses the faster method depending on the type (pd.MultiIndex.argsort is faster for strings and np.lexsort for ints).

Also switches the sorting for pandas categoricals, it now sorts by their codes instead of their values, both in counts_by_id and in maybe_compute_sort_indices.

review-notebook-app[bot] commented 5 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB