File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1891,6 +1891,20 @@ def test_rolling_corr_with_zero_variance(self, window):
18911891
18921892 assert s .rolling (window = window ).corr (other = other ).isna ().all ()
18931893
1894+ def test_rolling_max_datetimeindex (self ):
1895+ # GH 21096
1896+ n = 10
1897+ index = pd .date_range (start = "2018-1-1 01:00:00" , freq = "1min" , periods = n )
1898+ s = Series (data = 0 , index = index )
1899+
1900+ s .iloc [1 ] = np .nan
1901+ s .iloc [- 1 ] = 2
1902+ maxes = s .rolling (window = f"{ n } min" ).max ()
1903+ result = maxes .value_counts (dropna = False )
1904+ expected = Series (data = {0.0 : n - 1 , 2.0 : 1 })
1905+
1906+ tm .assert_series_equal (result , expected )
1907+
18941908 def _check_pairwise_moment (self , dispatch , name , ** kwargs ):
18951909 def get_result (obj , obj2 = None ):
18961910 return getattr (getattr (obj , dispatch )(** kwargs ), name )(obj2 )
You can’t perform that action at this time.
0 commit comments