javascriptdata / danfojs

Danfo.js is an open source, JavaScript library providing high performance, intuitive, and easy to use data structures for manipulating and processing structured data.
https://danfo.jsdata.org/
MIT License
4.8k stars 209 forks source link

Issue on .sort_values #192

Closed chris-sel closed 3 years ago

chris-sel commented 3 years ago

Describe the bug Getting back the same dataframe when attempting to df.sort_values (when keeping the date&time input as a column) or df.sort_index (when setting it as the index). Examined dataframe comes from uploaded timeseries data .csv file, which is parsed using PapaParse. dateSeries = df[df.column_names[0]].dt works fine.

Date & Time format example: 2019-05-29 13:44:00.000

To Reproduce Steps to reproduce the behavior: (1. Fetch local timeseries csv data using FileReader API

  1. Parse to JS object (array of objects) using PapaParse)
  2. Create a df = new dfd.DataFrame(parsed.data)
  3. dateSeries = df[df.column_names[0]].dt;
  4. Attempt to df.sort_values({by: df.column_names[0], inplace: true}) or df.set_index({ key: df.column_names[0], inplace: true }) df.sort_index({inplace: true});
  5. See unchanged dataframe

Expected behavior Expected sorting of the dataframe by the entry date of each input.

Desktop:

steveoni commented 3 years ago

@chris-sel if you are trying to parse uploaded file to danfojs can you check this out https://github.com/opensource9ja/Data-aRT/blob/master/src/App.js

If this is not what you want, can you paste a code example to fully replicate this error

risenW commented 3 years ago

Closing this as it looks stale