SciRuby / daru

Data Analysis in RUby
BSD 2-Clause "Simplified" License
1.03k stars 139 forks source link

#198 - Add rolling_fillna method to Daru::Dataframe and Daru::Vector #408

Closed baarkerlounger closed 6 years ago

baarkerlounger commented 6 years ago

https://github.com/SciRuby/daru/issues/198

Initial attempt at implementing a rolling fillna function. Straight forward replace with scalar value is not implemented since we already have replace_values function to do that. This just allows you to fill all Nil or NAN values with the last valid preceding or next valid following value.

zverok commented 6 years ago

Thanks! :tada:

baarkerlounger commented 6 years ago

@zverok thanks for merging. Think you accidentally merged rather than squash and merge though. Just a heads up.

zverok commented 6 years ago

Ooops. Strange, I believe squash-and-merge were our default button. I'll squash them on master.

zverok commented 6 years ago

Fixed, thanks for noticing!

lokeshh commented 6 years ago

How about we expose#rolling_fillna through more generic replace_values like this replace_values([nil], :forward_rolling)?

zverok commented 6 years ago

How about we expose#rolling_fillna through more generic replace_values like this replace_values([nil], :forward_rolling)?

I am not sure. What's the usecase?

lokeshh commented 6 years ago

We will have a simplified API as decided here https://github.com/SciRuby/daru/issues/137#issuecomment-236146562

Further one doesn't first need to convert missing value representation other than nil to nil first. One can directly apply replacevalues on say `` for example without converting it to nil first using replacevalues ([''], :forward_rolling)

zverok commented 6 years ago

ok.