@@ -822,6 +822,19 @@ def zip_frames(frames, axis=1):
822
822
zipped = [f .loc [i , :] for i in index for f in frames ]
823
823
return pd .DataFrame (zipped )
824
824
825
+ @composite
826
+ def indices (draw , max_length = 5 ):
827
+ date = draw (
828
+ dates (
829
+ min_value = Timestamp .min .ceil ("D" ).to_pydatetime ().date (),
830
+ max_value = Timestamp .max .floor ("D" ).to_pydatetime ().date (),
831
+ ).map (Timestamp )
832
+ )
833
+ periods = draw (integers (0 , max_length ))
834
+ freq = draw (sampled_from (list ("BDHTS" )))
835
+ dr = date_range (date , periods = periods , freq = freq )
836
+ return pd .DatetimeIndex (list (dr ))
837
+
825
838
826
839
class TestDataFrameAggregate ():
827
840
@@ -1142,20 +1155,7 @@ def test_agg_cython_table_raises(self, df, func, expected, axis):
1142
1155
with pytest .raises (expected ):
1143
1156
df .agg (func , axis = axis )
1144
1157
1145
- @composite
1146
- def indices (draw , max_length = 5 ):
1147
- date = draw (
1148
- dates (
1149
- min_value = Timestamp .min .ceil ("D" ).to_pydatetime ().date (),
1150
- max_value = Timestamp .max .floor ("D" ).to_pydatetime ().date (),
1151
- ).map (Timestamp )
1152
- )
1153
- periods = draw (integers (0 , max_length ))
1154
- freq = draw (sampled_from (list ("BDHTS" )))
1155
- dr = date_range (date , periods = periods , freq = freq )
1156
- return pd .DatetimeIndex (list (dr ))
1157
-
1158
- @given (index = indices (5 ), num_columns = integers (0 , 5 ))
1158
+ @given (index = indices (max_length = 5 ), num_columns = integers (0 , 5 ))
1159
1159
def test_frequency_is_original (self , index , num_columns ):
1160
1160
# GH 22150
1161
1161
original = index .copy ()
0 commit comments