@@ -731,6 +731,33 @@ def test_expanding(func):
731731 assert_eq (result , expected )
732732
733733
734+ def test_ewm_mean ():
735+ sdf = DataFrame (example = pd .DataFrame (columns = ['x' , 'y' ]))
736+ L = sdf .ewm (1 ).mean ().stream .gather ().sink_to_list ()
737+ sdf .emit (pd .DataFrame ({'x' : [1. ], 'y' : [2. ]}))
738+ sdf .emit (pd .DataFrame ({'x' : [2. ], 'y' : [3. ]}))
739+ sdf .emit (pd .DataFrame ({'x' : [3. ], 'y' : [4. ]}))
740+ result = pd .concat (L , ignore_index = True )
741+
742+ df = pd .DataFrame ({'x' : [1. , 2. , 3. ], 'y' : [2. , 3. , 4. ]})
743+ expected = df .ewm (1 ).mean ()
744+ assert_eq (result , expected )
745+
746+
747+ @pytest .mark .parametrize ('func' , [
748+ lambda x : x .sum (),
749+ lambda x : x .count (),
750+ lambda x : x .apply (lambda x : x ),
751+ lambda x : x .full (),
752+ lambda x : x .var (),
753+ lambda x : x .std ()
754+ ], ids = ["sum" , "count" , "apply" , "full" , "var" , "std" ])
755+ def test_ewm_notimplemented (func ):
756+ sdf = DataFrame (example = pd .DataFrame (columns = ['x' , 'y' ]))
757+ with pytest .raises (NotImplementedError ):
758+ func (sdf .ewm (1 ))
759+
760+
734761@pytest .mark .parametrize ('func' , [
735762 lambda x : x .sum (),
736763 lambda x : x .mean (),
0 commit comments