go-gota / gota

Gota: DataFrames and data wrangling in Go (Golang)
Other
2.98k stars 276 forks source link

series.Mean() returns NaN when any element in a series of floats is NaN #114

Open evanmcclure opened 4 years ago

evanmcclure commented 4 years ago

I was exploring a dataset and discovered that when any element in a Series of floats is NaN, the function called series.Mean() invalidates the entire series and returns NaN. I expected series.Mean() to exclude values with NaN when computing the mean.

evanmcclure commented 4 years ago

I believe the fix should happen within series.Float(), perhaps using another version of series.Float() lets the user exclude NaN values, before the slice ever gets passed to gonum. I believe the other statistical functions in Series should also have the same behavior. That is, exclude NaN values in the series.

evanmcclure commented 4 years ago

I'll clone and submit a PR for this change. Then, you can let me know if you think this is worthwhile.

dalizitajiu commented 2 years ago

I'll clone and submit a PR for this change. Then, you can let me know if you think this is worthwhile.

has this pr merged to master branch?

salahuiste commented 1 year ago

@dalizitajiu same question