danfojs
danfojs copied to clipboard
String Series sortValues is Backwards
Describe the bug
When sorting a column of strings, ascending and descending behaviors are reversed.
To Reproduce
>> s = new dfd.Series(["2015-01-01", "2023-01-01", "2017-01-01", "2010-01-01"])
// 1. Sort values by default order, which from documentation says is ascending...
>> s.sortValues().values
// Array(4) [ "2023-01-01", "2017-01-01", "2015-01-01", "2010-01-01" ]
// 2. Set explicit ascending: true...
>> s.sortValues({ ascending: true }).values
// Array(4) [ "2023-01-01", "2017-01-01", "2015-01-01", "2010-01-01" ]
// 3. Set explicit ascending: false...
>> s.sortValues({ ascending: false }).values
// Array(4) [ "2010-01-01", "2015-01-01", "2017-01-01", "2023-01-01" ]
Expected behavior I would expect string series ascending sort order to be ascending, and specifically match Array.sort ascending behavior strings.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: MacOS, Windows
- Browser: Firefox, Chrome
- Version: 115, 114