@@ -5915,21 +5915,15 @@ def test_dataframe_explode_xfail(col_names):
59155915 pytest .param ("datetime_col" , "5M" , "epoch" ),
59165916 pytest .param ("datetime_col" , "3Q" , "start_day" ),
59175917 pytest .param ("datetime_col" , "3YE" , "start" ),
5918- pytest .param (
5919- "int64_col" , "100D" , "start" , marks = pytest .mark .xfail (raises = TypeError )
5920- ),
5921- pytest .param (
5922- "datetime_col" , "100D" , "end" , marks = pytest .mark .xfail (raises = ValueError )
5923- ),
59245918 ],
59255919)
5926- def test__resample_with_column (
5920+ def test_resample_with_column (
59275921 scalars_df_index , scalars_pandas_df_index , on , rule , origin
59285922):
59295923 # TODO: supply a reason why this isn't compatible with pandas 1.x
59305924 pytest .importorskip ("pandas" , minversion = "2.0.0" )
59315925 bf_result = (
5932- scalars_df_index ._resample (rule = rule , on = on , origin = origin )[
5926+ scalars_df_index .resample (rule = rule , on = on , origin = origin )[
59335927 ["int64_col" , "int64_too" ]
59345928 ]
59355929 .max ()
@@ -5943,30 +5937,54 @@ def test__resample_with_column(
59435937 )
59445938
59455939
5940+ @pytest .mark .parametrize ("index_col" , ["timestamp_col" , "datetime_col" ])
5941+ @pytest .mark .parametrize (
5942+ ("index_append" , "level" ),
5943+ [(True , 1 ), (False , None ), (False , 0 )],
5944+ )
59465945@pytest .mark .parametrize (
5947- ( "append" , "level" , "col" , " rule") ,
5946+ " rule" ,
59485947 [
5949- pytest .param (False , None , "timestamp_col" , "100d" ),
5950- pytest .param (True , 1 , "timestamp_col" , "1200h" ),
5951- pytest .param (False , None , "datetime_col" , "100d" ),
5948+ # TODO(tswast): support timedeltas and dataoffsets.
5949+ # TODO(tswast): support bins that default to "right".
5950+ "100d" ,
5951+ "1200h" ,
59525952 ],
59535953)
5954- def test__resample_with_index (
5955- scalars_df_index , scalars_pandas_df_index , append , level , col , rule
5954+ # TODO(tswast): support "right"
5955+ @pytest .mark .parametrize ("closed" , ["left" , None ])
5956+ # TODO(tswast): support "right"
5957+ @pytest .mark .parametrize ("label" , ["left" , None ])
5958+ @pytest .mark .parametrize (
5959+ "origin" ,
5960+ ["epoch" , "start" , "start_day" ], # TODO(tswast): support end, end_day.
5961+ )
5962+ def test_resample_with_index (
5963+ scalars_df_index ,
5964+ scalars_pandas_df_index ,
5965+ index_append ,
5966+ level ,
5967+ index_col ,
5968+ rule ,
5969+ closed ,
5970+ origin ,
5971+ label ,
59565972):
59575973 # TODO: supply a reason why this isn't compatible with pandas 1.x
59585974 pytest .importorskip ("pandas" , minversion = "2.0.0" )
5959- scalars_df_index = scalars_df_index .set_index (col , append = append )
5960- scalars_pandas_df_index = scalars_pandas_df_index .set_index (col , append = append )
5975+ scalars_df_index = scalars_df_index .set_index (index_col , append = index_append )
5976+ scalars_pandas_df_index = scalars_pandas_df_index .set_index (
5977+ index_col , append = index_append
5978+ )
59615979 bf_result = (
59625980 scalars_df_index [["int64_col" , "int64_too" ]]
5963- ._resample (rule = rule , level = level )
5981+ .resample (rule = rule , level = level , closed = closed , origin = origin , label = label )
59645982 .min ()
59655983 .to_pandas ()
59665984 )
59675985 pd_result = (
59685986 scalars_pandas_df_index [["int64_col" , "int64_too" ]]
5969- .resample (rule = rule , level = level )
5987+ .resample (rule = rule , level = level , closed = closed , origin = origin , label = label )
59705988 .min ()
59715989 )
59725990 assert_pandas_df_equal (bf_result , pd_result )
@@ -6010,15 +6028,15 @@ def test__resample_with_index(
60106028 ),
60116029 ],
60126030)
6013- def test__resample_start_time (rule , origin , data ):
6031+ def test_resample_start_time (rule , origin , data ):
60146032 # TODO: supply a reason why this isn't compatible with pandas 1.x
60156033 pytest .importorskip ("pandas" , minversion = "2.0.0" )
60166034 col = "timestamp_col"
60176035 scalars_df_index = bpd .DataFrame (data ).set_index (col )
60186036 scalars_pandas_df_index = pd .DataFrame (data ).set_index (col )
60196037 scalars_pandas_df_index .index .name = None
60206038
6021- bf_result = scalars_df_index ._resample (rule = rule , origin = origin ).min ().to_pandas ()
6039+ bf_result = scalars_df_index .resample (rule = rule , origin = origin ).min ().to_pandas ()
60226040
60236041 pd_result = scalars_pandas_df_index .resample (rule = rule , origin = origin ).min ()
60246042
0 commit comments