4242 assert_series_equal ,
4343 convert_pandas_dtypes ,
4444 get_first_file_from_wildcard ,
45- pandas_major_version ,
4645)
4746
4847pytest .importorskip ("polars" )
@@ -148,7 +147,7 @@ def test_series_construct_timestamps():
148147 bf_result = series .Series (datetimes ).to_pandas ()
149148 pd_result = pd .Series (datetimes , dtype = pd .ArrowDtype (pa .timestamp ("us" )))
150149
151- assert_series_equal (bf_result , pd_result , check_index_type = False )
150+ pd . testing . assert_series_equal (bf_result , pd_result , check_index_type = False )
152151
153152
154153def test_series_construct_copy_with_index (scalars_dfs ):
@@ -314,7 +313,9 @@ def test_series_construct_geodata():
314313
315314 series = bigframes .pandas .Series (pd_series )
316315
317- assert_series_equal (pd_series , series .to_pandas (), check_index_type = False )
316+ pd .testing .assert_series_equal (
317+ pd_series , series .to_pandas (), check_index_type = False
318+ )
318319
319320
320321@pytest .mark .parametrize (
@@ -580,8 +581,6 @@ def test_series___getitem__(scalars_dfs, index_col, key):
580581 ),
581582)
582583def test_series___getitem___with_int_key (scalars_dfs , key ):
583- if pd .__version__ .startswith ("3." ):
584- pytest .skip ("pandas 3.0 dropped getitem with int key" )
585584 col_name = "int64_too"
586585 index_col = "string_col"
587586 scalars_df , scalars_pandas_df = scalars_dfs
@@ -836,7 +835,7 @@ def test_series_dropna(scalars_dfs, ignore_index):
836835 col_name = "string_col"
837836 bf_result = scalars_df [col_name ].dropna (ignore_index = ignore_index ).to_pandas ()
838837 pd_result = scalars_pandas_df [col_name ].dropna (ignore_index = ignore_index )
839- assert_series_equal (pd_result , bf_result , check_index_type = False )
838+ pd . testing . assert_series_equal (pd_result , bf_result , check_index_type = False )
840839
841840
842841@pytest .mark .parametrize (
@@ -1180,7 +1179,7 @@ def test_mods(scalars_dfs, col_x, col_y, method):
11801179 else :
11811180 bf_result = bf_series .astype ("Float64" ).to_pandas ()
11821181 pd_result = getattr (scalars_pandas_df [col_x ], method )(scalars_pandas_df [col_y ])
1183- assert_series_equal (pd_result , bf_result , nulls_are_nan = True )
1182+ pd . testing . assert_series_equal (pd_result , bf_result )
11841183
11851184
11861185# We work around a pandas bug that doesn't handle correlating nullable dtypes by doing this
@@ -1880,10 +1879,6 @@ def test_series_binop_w_other_types(scalars_dfs, other):
18801879 bf_result = (scalars_df ["int64_col" ].head (3 ) + other ).to_pandas ()
18811880 pd_result = scalars_pandas_df ["int64_col" ].head (3 ) + other
18821881
1883- if isinstance (other , pd .Series ):
1884- # pandas 3.0 preserves series name, bigframe, earlier pandas do not
1885- pd_result .index .name = bf_result .index .name
1886-
18871882 assert_series_equal (
18881883 bf_result ,
18891884 pd_result ,
@@ -3967,7 +3962,7 @@ def test_string_astype_date():
39673962 pd_result = pd_series .astype ("date32[day][pyarrow]" ) # type: ignore
39683963 bf_result = bf_series .astype ("date32[day][pyarrow]" ).to_pandas ()
39693964
3970- assert_series_equal (bf_result , pd_result , check_index_type = False )
3965+ pd . testing . assert_series_equal (bf_result , pd_result , check_index_type = False )
39713966
39723967
39733968def test_string_astype_datetime ():
@@ -3980,7 +3975,7 @@ def test_string_astype_datetime():
39803975 pd_result = pd_series .astype (pd .ArrowDtype (pa .timestamp ("us" )))
39813976 bf_result = bf_series .astype (pd .ArrowDtype (pa .timestamp ("us" ))).to_pandas ()
39823977
3983- assert_series_equal (bf_result , pd_result , check_index_type = False )
3978+ pd . testing . assert_series_equal (bf_result , pd_result , check_index_type = False )
39843979
39853980
39863981def test_string_astype_timestamp ():
@@ -3999,7 +3994,7 @@ def test_string_astype_timestamp():
39993994 pd .ArrowDtype (pa .timestamp ("us" , tz = "UTC" ))
40003995 ).to_pandas ()
40013996
4002- assert_series_equal (bf_result , pd_result , check_index_type = False )
3997+ pd . testing . assert_series_equal (bf_result , pd_result , check_index_type = False )
40033998
40043999
40054000@pytest .mark .skip (reason = "AssertionError: Series are different" )
@@ -4620,20 +4615,15 @@ def test_apply_lambda(scalars_dfs, col, lambda_):
46204615 bf_result = bf_col .apply (lambda_ , by_row = False ).to_pandas ()
46214616
46224617 pd_col = scalars_pandas_df [col ]
4623- if pd .__version__ [:3 ] in ("2.2" , "2.3" ) or pandas_major_version () >= 3 :
4618+ if pd .__version__ [:3 ] in ("2.2" , "2.3" ):
46244619 pd_result = pd_col .apply (lambda_ , by_row = False )
46254620 else :
46264621 pd_result = pd_col .apply (lambda_ )
46274622
46284623 # ignore dtype check, which are Int64 and object respectively
46294624 # Some columns implicitly convert to floating point. Use check_exact=False to ensure we're "close enough"
46304625 assert_series_equal (
4631- bf_result ,
4632- pd_result ,
4633- check_dtype = False ,
4634- check_exact = False ,
4635- rtol = 0.001 ,
4636- nulls_are_nan = True ,
4626+ bf_result , pd_result , check_dtype = False , check_exact = False , rtol = 0.001
46374627 )
46384628
46394629
@@ -4815,12 +4805,7 @@ def foo(x):
48154805 # ignore dtype check, which are Int64 and object respectively
48164806 # Some columns implicitly convert to floating point. Use check_exact=False to ensure we're "close enough"
48174807 assert_series_equal (
4818- bf_result ,
4819- pd_result ,
4820- check_dtype = False ,
4821- check_exact = False ,
4822- rtol = 0.001 ,
4823- nulls_are_nan = True ,
4808+ bf_result , pd_result , check_dtype = False , check_exact = False , rtol = 0.001
48244809 )
48254810
48264811
@@ -4939,7 +4924,7 @@ def test_series_explode_w_index(index, ignore_index):
49394924 s = bigframes .pandas .Series (data , index = index )
49404925 pd_s = pd .Series (data , index = index )
49414926 # TODO(b/340885567): fix type error
4942- assert_series_equal (
4927+ pd . testing . assert_series_equal (
49434928 s .explode (ignore_index = ignore_index ).to_pandas (), # type: ignore
49444929 pd_s .explode (ignore_index = ignore_index ).astype (pd .Float64Dtype ()), # type: ignore
49454930 check_index_type = False ,
0 commit comments