@@ -205,39 +205,6 @@ def _check(self, df, method, expected_columns, expected_columns_numeric):
205
205
tm .assert_index_equal (result .columns , expected_columns )
206
206
207
207
208
- @pytest .mark .parametrize (
209
- "i" ,
210
- [
211
- (
212
- Timestamp ("2011-01-15 12:50:28.502376" ),
213
- Timestamp ("2011-01-20 12:50:28.593448" ),
214
- ),
215
- (24650000000000001 , 24650000000000002 ),
216
- ],
217
- )
218
- def test_groupby_non_arithmetic_agg_int_like_precision (i ):
219
- # see gh-6620, gh-9311
220
- df = DataFrame ([{"a" : 1 , "b" : i [0 ]}, {"a" : 1 , "b" : i [1 ]}])
221
-
222
- grp_exp = {
223
- "first" : {"expected" : i [0 ]},
224
- "last" : {"expected" : i [1 ]},
225
- "min" : {"expected" : i [0 ]},
226
- "max" : {"expected" : i [1 ]},
227
- "nth" : {"expected" : i [1 ], "args" : [1 ]},
228
- "count" : {"expected" : 2 },
229
- }
230
-
231
- for method , data in grp_exp .items ():
232
- if "args" not in data :
233
- data ["args" ] = []
234
-
235
- grouped = df .groupby ("a" )
236
- res = getattr (grouped , method )(* data ["args" ])
237
-
238
- assert res .iloc [0 ].b == data ["expected" ]
239
-
240
-
241
208
@pytest .mark .parametrize ("numeric_only" , [True , False , None ])
242
209
def test_axis1_numeric_only (request , groupby_func , numeric_only ):
243
210
if groupby_func in ("idxmax" , "idxmin" ):
@@ -543,43 +510,3 @@ def test_deprecate_numeric_only_series(dtype, groupby_func, request):
543
510
result = method (* args , numeric_only = True )
544
511
expected = method (* args , numeric_only = False )
545
512
tm .assert_series_equal (result , expected )
546
-
547
-
548
- def test_multiindex_group_all_columns_when_empty (groupby_func ):
549
- # GH 32464
550
- df = DataFrame ({"a" : [], "b" : [], "c" : []}).set_index (["a" , "b" , "c" ])
551
- gb = df .groupby (["a" , "b" , "c" ], group_keys = False )
552
- method = getattr (gb , groupby_func )
553
- args = get_groupby_method_args (groupby_func , df )
554
-
555
- warn = FutureWarning if groupby_func == "fillna" else None
556
- warn_msg = "DataFrameGroupBy.fillna is deprecated"
557
- with tm .assert_produces_warning (warn , match = warn_msg ):
558
- result = method (* args ).index
559
- expected = df .index
560
- tm .assert_index_equal (result , expected )
561
-
562
-
563
- def test_duplicate_columns (request , groupby_func , as_index ):
564
- # GH#50806
565
- if groupby_func == "corrwith" :
566
- msg = "GH#50845 - corrwith fails when there are duplicate columns"
567
- request .applymarker (pytest .mark .xfail (reason = msg ))
568
- df = DataFrame ([[1 , 3 , 6 ], [1 , 4 , 7 ], [2 , 5 , 8 ]], columns = list ("abb" ))
569
- args = get_groupby_method_args (groupby_func , df )
570
- gb = df .groupby ("a" , as_index = as_index )
571
- warn = FutureWarning if groupby_func == "fillna" else None
572
- warn_msg = "DataFrameGroupBy.fillna is deprecated"
573
- with tm .assert_produces_warning (warn , match = warn_msg ):
574
- result = getattr (gb , groupby_func )(* args )
575
-
576
- expected_df = df .set_axis (["a" , "b" , "c" ], axis = 1 )
577
- expected_args = get_groupby_method_args (groupby_func , expected_df )
578
- expected_gb = expected_df .groupby ("a" , as_index = as_index )
579
- warn = FutureWarning if groupby_func == "fillna" else None
580
- warn_msg = "DataFrameGroupBy.fillna is deprecated"
581
- with tm .assert_produces_warning (warn , match = warn_msg ):
582
- expected = getattr (expected_gb , groupby_func )(* expected_args )
583
- if groupby_func not in ("size" , "ngroup" , "cumcount" ):
584
- expected = expected .rename (columns = {"c" : "b" })
585
- tm .assert_equal (result , expected )
0 commit comments