@@ -73,27 +73,6 @@ def test_df_ufuncs(scalars_dfs, opname):
7373 pd .testing .assert_frame_equal (bf_result , pd_result )
7474
7575
76- @pytest .mark .parametrize (
77- ("opname" ,),
78- [
79- ("add" ,),
80- ("subtract" ,),
81- ("multiply" ,),
82- ("divide" ,),
83- ("power" ,),
84- ("arctan2" ,),
85- ],
86- )
87- def test_series_binary_ufuncs (floats_product_pd , floats_product_bf , opname ):
88- bf_result = getattr (np , opname )(
89- floats_product_bf .float64_col_x , floats_product_bf .float64_col_y
90- ).to_pandas ()
91- pd_result = getattr (np , opname )(
92- floats_product_pd .float64_col_x , floats_product_pd .float64_col_y
93- )
94- pd .testing .assert_series_equal (bf_result , pd_result )
95-
96-
9776@pytest .mark .parametrize (
9877 ("opname" ,),
9978 [
@@ -106,30 +85,42 @@ def test_series_binary_ufuncs(floats_product_pd, floats_product_bf, opname):
10685)
10786def test_df_binary_ufuncs (scalars_dfs , opname ):
10887 scalars_df , scalars_pandas_df = scalars_dfs
88+ op = getattr (np , opname )
10989
110- bf_result = getattr (np , opname )(
111- scalars_df [["float64_col" , "int64_col" ]], 5.1
112- ).to_pandas ()
113- pd_result = getattr (np , opname )(
114- scalars_pandas_df [["float64_col" , "int64_col" ]], 5.1
115- )
90+ bf_result = op (scalars_df [["float64_col" , "int64_col" ]], 5.1 ).to_pandas ()
91+ pd_result = op (scalars_pandas_df [["float64_col" , "int64_col" ]], 5.1 )
11692
11793 pd .testing .assert_frame_equal (bf_result , pd_result )
11894
11995
96+ # Operations tested here don't work on full dataframe in numpy+pandas
97+ # Maybe because of nullable dtypes?
12098@pytest .mark .parametrize (
12199 ("x" , "y" ),
122100 [
123101 ("int64_col" , "int64_col" ),
124102 ("float64_col" , "int64_col" ),
125103 ],
126104)
127- def test_series_atan2 (scalars_dfs , x , y ):
128- # Test atan2 separately as pandas errors when passing entire df as input, so pass only series
105+ @pytest .mark .parametrize (
106+ ("opname" ,),
107+ [
108+ ("add" ,),
109+ ("subtract" ,),
110+ ("multiply" ,),
111+ ("divide" ,),
112+ ("arctan2" ,),
113+ ("minimum" ,),
114+ ("maximum" ,),
115+ ],
116+ )
117+ def test_series_binary_ufuncs (scalars_dfs , x , y , opname ):
129118 scalars_df , scalars_pandas_df = scalars_dfs
130119
131- bf_result = np .arctan2 (scalars_df [x ], scalars_df [y ]).to_pandas ()
132- pd_result = np .arctan2 (scalars_pandas_df [x ], scalars_pandas_df [y ])
120+ op = getattr (np , opname )
121+
122+ bf_result = op (scalars_df [x ], scalars_df [y ]).to_pandas ()
123+ pd_result = op (scalars_pandas_df [x ], scalars_pandas_df [y ])
133124
134125 pd .testing .assert_series_equal (bf_result , pd_result )
135126
0 commit comments