@@ -209,20 +209,24 @@ def f():
209209
210210 def test_count_nonnumeric_types (self ):
211211 # GH12541
212- cols = ['int' , 'float' , 'string' , 'datetime' , 'timedelta' ,
213- 'fl_inf' , 'fl_nan' , 'str_nan' , 'dt_nat' ]
212+ cols = ['int' , 'float' , 'string' , 'datetime' , 'timedelta' , 'periods' ,
213+ 'fl_inf' , 'fl_nan' , 'str_nan' , 'dt_nat' , 'periods_nat' ]
214214
215215 df = DataFrame (
216216 {'int' : [1 , 2 , 3 ],
217217 'float' : [4. , 5. , 6. ],
218218 'string' : list ('abc' ),
219219 'datetime' : pd .date_range ('20170101' , periods = 3 ),
220220 'timedelta' : pd .timedelta_range ('1 s' , periods = 3 , freq = 's' ),
221+ 'periods' : [pd .Period ('2012-01' ), pd .Period ('2012-02' ),
222+ pd .Period ('2012-03' )],
221223 'fl_inf' : [1. , 2. , np .Inf ],
222224 'fl_nan' : [1. , 2. , np .NaN ],
223225 'str_nan' : ['aa' , 'bb' , np .NaN ],
224226 'dt_nat' : [pd .Timestamp ('20170101' ), pd .Timestamp ('20170203' ),
225- pd .Timestamp (None )]},
227+ pd .Timestamp (None )],
228+ 'periods_nat' : [pd .Period ('2012-01' ), pd .Period ('2012-02' ),
229+ pd .Period (None )]},
226230 columns = cols )
227231
228232 expected = DataFrame (
@@ -231,10 +235,12 @@ def test_count_nonnumeric_types(self):
231235 'string' : [1. , 2. , 2. ],
232236 'datetime' : [1. , 2. , 2. ],
233237 'timedelta' : [1. , 2. , 2. ],
238+ 'periods' : [1. , 2. , 2. ],
234239 'fl_inf' : [1. , 2. , 2. ],
235240 'fl_nan' : [1. , 2. , 1. ],
236241 'str_nan' : [1. , 2. , 1. ],
237- 'dt_nat' : [1. , 2. , 1. ]},
242+ 'dt_nat' : [1. , 2. , 1. ],
243+ 'periods_nat' : [1. , 2. , 1. ]},
238244 columns = cols )
239245
240246 self .assert_frame_equal (df .rolling (window = 2 ).count (), expected )
0 commit comments