diff --git a/dataframe_fillna.go b/dataframe_fillna.go new file mode 100644 index 0000000000000000000000000000000000000000..9665cf207ec8c53d22676fd0087ebcc0c18b7bc9 --- /dev/null +++ b/dataframe_fillna.go @@ -0,0 +1,10 @@ +package pandas + +// FillNa dataframe实现FillNa +func (self DataFrame) FillNa(v any, inplace bool) { + for _, series := range self.columns { + if series.Len() > 0 { + series.FillNa(v, inplace) + } + } +} diff --git a/dataframe_test.go b/dataframe_test.go index 3283c08819f02eac68c734a9a0c4e96f4e625a9f..f1ef0733b183b07f286b83a4fcf9365bd3877cad 100644 --- a/dataframe_test.go +++ b/dataframe_test.go @@ -17,6 +17,8 @@ func TestDataFrameT0(t *testing.T) { s2 := s1.Shift(-2) df := NewDataFrame(s1, s2) fmt.Println(df) + df.FillNa(0.00, true) + fmt.Println(df) _ = s2 }