@@ -73,27 +73,6 @@ def test_df_ufuncs(scalars_dfs, opname):
73
73
pd .testing .assert_frame_equal (bf_result , pd_result )
74
74
75
75
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
-
97
76
@pytest .mark .parametrize (
98
77
("opname" ,),
99
78
[
@@ -106,30 +85,42 @@ def test_series_binary_ufuncs(floats_product_pd, floats_product_bf, opname):
106
85
)
107
86
def test_df_binary_ufuncs (scalars_dfs , opname ):
108
87
scalars_df , scalars_pandas_df = scalars_dfs
88
+ op = getattr (np , opname )
109
89
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 )
116
92
117
93
pd .testing .assert_frame_equal (bf_result , pd_result )
118
94
119
95
96
+ # Operations tested here don't work on full dataframe in numpy+pandas
97
+ # Maybe because of nullable dtypes?
120
98
@pytest .mark .parametrize (
121
99
("x" , "y" ),
122
100
[
123
101
("int64_col" , "int64_col" ),
124
102
("float64_col" , "int64_col" ),
125
103
],
126
104
)
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 ):
129
118
scalars_df , scalars_pandas_df = scalars_dfs
130
119
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 ])
133
124
134
125
pd .testing .assert_series_equal (bf_result , pd_result )
135
126
0 commit comments