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.81k stars 209 forks source link

Add diff/pctChange to Series #429

Open joshuakoh1 opened 2 years ago

joshuakoh1 commented 2 years ago

diff and pctChange features added in https://github.com/javascriptdata/danfojs/pull/418 https://github.com/javascriptdata/danfojs/pull/414 only extend to DataFrames. Currently unable to apply to a single column slice without adding extra steps.

risenW commented 2 years ago

@NeonSpork Would you like to work on this?

NeonSpork commented 2 years ago

I think we need more information specifically about what you're trying to achieve that's failing, and how @joshuakoh1 ?

The diff/pctChange functions should mirror the behavior of the other math functions like pow etc, and it should accept a single number, series, column, etc, already.

Can you provide example code, errors and more detailed information about what behavior you expected please?

joshuakoh1 commented 2 years ago

@NeonSpork Just trying to calc the diff/pctChange for a single series instead of the full DataFrame. Would like to be able to do df.column.pctChange(1) instead of df.pctChange(1).column. The latter performs unnecessary operations.