@@ -83,17 +83,32 @@ def test_align_float(self, float_frame, using_copy_on_write):
83
83
af , bf = float_frame .align (other , join = "inner" , axis = 1 )
84
84
tm .assert_index_equal (bf .columns , other .columns )
85
85
86
- af , bf = float_frame .align (other , join = "inner" , axis = 1 , method = "pad" )
86
+ msg = (
87
+ "The 'method', 'limit', and 'fill_axis' keywords in DataFrame.align "
88
+ "are deprecated"
89
+ )
90
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
91
+ af , bf = float_frame .align (other , join = "inner" , axis = 1 , method = "pad" )
87
92
tm .assert_index_equal (bf .columns , other .columns )
88
93
89
- af , bf = float_frame .align (
90
- other .iloc [:, 0 ], join = "inner" , axis = 1 , method = None , fill_value = None
94
+ msg = (
95
+ "The 'method', 'limit', and 'fill_axis' keywords in DataFrame.align "
96
+ "are deprecated"
91
97
)
98
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
99
+ af , bf = float_frame .align (
100
+ other .iloc [:, 0 ], join = "inner" , axis = 1 , method = None , fill_value = None
101
+ )
92
102
tm .assert_index_equal (bf .index , Index ([]))
93
103
94
- af , bf = float_frame .align (
95
- other .iloc [:, 0 ], join = "inner" , axis = 1 , method = None , fill_value = 0
104
+ msg = (
105
+ "The 'method', 'limit', and 'fill_axis' keywords in DataFrame.align "
106
+ "are deprecated"
96
107
)
108
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
109
+ af , bf = float_frame .align (
110
+ other .iloc [:, 0 ], join = "inner" , axis = 1 , method = None , fill_value = 0
111
+ )
97
112
tm .assert_index_equal (bf .index , Index ([]))
98
113
99
114
# Try to align DataFrame to Series along bad axis
@@ -134,30 +149,50 @@ def test_align_int(self, int_frame):
134
149
# test other non-float types
135
150
other = DataFrame (index = range (5 ), columns = ["A" , "B" , "C" ])
136
151
137
- af , bf = int_frame .align (other , join = "inner" , axis = 1 , method = "pad" )
152
+ msg = (
153
+ "The 'method', 'limit', and 'fill_axis' keywords in DataFrame.align "
154
+ "are deprecated"
155
+ )
156
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
157
+ af , bf = int_frame .align (other , join = "inner" , axis = 1 , method = "pad" )
138
158
tm .assert_index_equal (bf .columns , other .columns )
139
159
140
160
def test_align_mixed_type (self , float_string_frame ):
141
- af , bf = float_string_frame .align (
142
- float_string_frame , join = "inner" , axis = 1 , method = "pad"
161
+ msg = (
162
+ "The 'method', 'limit', and 'fill_axis' keywords in DataFrame.align "
163
+ "are deprecated"
143
164
)
165
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
166
+ af , bf = float_string_frame .align (
167
+ float_string_frame , join = "inner" , axis = 1 , method = "pad"
168
+ )
144
169
tm .assert_index_equal (bf .columns , float_string_frame .columns )
145
170
146
171
def test_align_mixed_float (self , mixed_float_frame ):
147
172
# mixed floats/ints
148
173
other = DataFrame (index = range (5 ), columns = ["A" , "B" , "C" ])
149
174
150
- af , bf = mixed_float_frame .align (
151
- other .iloc [:, 0 ], join = "inner" , axis = 1 , method = None , fill_value = 0
175
+ msg = (
176
+ "The 'method', 'limit', and 'fill_axis' keywords in DataFrame.align "
177
+ "are deprecated"
152
178
)
179
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
180
+ af , bf = mixed_float_frame .align (
181
+ other .iloc [:, 0 ], join = "inner" , axis = 1 , method = None , fill_value = 0
182
+ )
153
183
tm .assert_index_equal (bf .index , Index ([]))
154
184
155
185
def test_align_mixed_int (self , mixed_int_frame ):
156
186
other = DataFrame (index = range (5 ), columns = ["A" , "B" , "C" ])
157
187
158
- af , bf = mixed_int_frame .align (
159
- other .iloc [:, 0 ], join = "inner" , axis = 1 , method = None , fill_value = 0
188
+ msg = (
189
+ "The 'method', 'limit', and 'fill_axis' keywords in DataFrame.align "
190
+ "are deprecated"
160
191
)
192
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
193
+ af , bf = mixed_int_frame .align (
194
+ other .iloc [:, 0 ], join = "inner" , axis = 1 , method = None , fill_value = 0
195
+ )
161
196
tm .assert_index_equal (bf .index , Index ([]))
162
197
163
198
@pytest .mark .parametrize (
@@ -348,10 +383,16 @@ def test_missing_axis_specification_exception(self):
348
383
df .align (series )
349
384
350
385
def _check_align (self , a , b , axis , fill_axis , how , method , limit = None ):
351
- aa , ab = a .align (
352
- b , axis = axis , join = how , method = method , limit = limit , fill_axis = fill_axis
386
+ msg = (
387
+ "The 'method', 'limit', and 'fill_axis' keywords in DataFrame.align "
388
+ "are deprecated"
353
389
)
354
390
391
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
392
+ aa , ab = a .align (
393
+ b , axis = axis , join = how , method = method , limit = limit , fill_axis = fill_axis
394
+ )
395
+
355
396
join_index , join_columns = None , None
356
397
357
398
ea , eb = a , b
0 commit comments