How to filter out NaN rows?
denghejun opened this issue · comments
Hejun Deng commented
How to filter out NaN rows?
filteredDF := dfLeftJoin.Filter(dataframe.F{
Colname: "primary_tag",
Comparator: series.Eq,
Comparando: "", // "", "NaN", "null", "NULL", all of them don't work
})
Ryan Piaskowy commented
In case others come across this question, this is how I accomplished it in my project:
Created a function to return the filter function for only NaNs:
func IsNaNFilter() func() func(el series.Element) bool {
isNaNFunction := func() func(el series.Element) bool {
return func(el series.Element) bool {
return el.IsNA()
}
}
return isNaNFunction
}
Then whenever I need to filter to only rows that the value is NaN, I do this:
isNaN := IsNaNFilter()
out = out.Filter(dataframe.F{
Colname: "ColName",
Comparator: series.CompFunc,
Comparando: isNaN()})