@@ -380,15 +380,16 @@ def test_agg_apply_evaluate_lambdas_the_same(string_series):
380
380
def test_with_nested_series (datetime_series ):
381
381
# GH 2316
382
382
# .agg with a reducer and a transform, what to do
383
- with tm .assert_produces_warning (FutureWarning , match = "converting list of Series" ):
383
+ msg = "Returning a DataFrame from Series.apply when the supplied function"
384
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
384
385
# GH52123
385
386
result = datetime_series .apply (
386
387
lambda x : Series ([x , x ** 2 ], index = ["x" , "x^2" ])
387
388
)
388
389
expected = DataFrame ({"x" : datetime_series , "x^2" : datetime_series ** 2 })
389
390
tm .assert_frame_equal (result , expected )
390
391
391
- with tm .assert_produces_warning (FutureWarning , match = "converting list of Series" ):
392
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
392
393
# GH52123
393
394
result = datetime_series .agg (lambda x : Series ([x , x ** 2 ], index = ["x" , "x^2" ]))
394
395
tm .assert_frame_equal (result , expected )
@@ -836,7 +837,8 @@ def test_apply_series_on_date_time_index_aware_series(dti, exp, aware):
836
837
index = dti .tz_localize ("UTC" ).index
837
838
else :
838
839
index = dti .index
839
- with tm .assert_produces_warning (FutureWarning , match = "converting list of Series" ):
840
+ msg = "Returning a DataFrame from Series.apply when the supplied function"
841
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
840
842
# GH52123
841
843
result = Series (index ).apply (lambda x : Series ([1 , 2 ]))
842
844
tm .assert_frame_equal (result , exp )
@@ -948,7 +950,8 @@ def test_apply_retains_column_name():
948
950
# GH 16380
949
951
df = DataFrame ({"x" : range (3 )}, Index (range (3 ), name = "x" ))
950
952
func = lambda x : Series (range (x + 1 ), Index (range (x + 1 ), name = "y" ))
951
- with tm .assert_produces_warning (FutureWarning , match = "converting list of Series" ):
953
+ msg = "Returning a DataFrame from Series.apply when the supplied function"
954
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
952
955
# GH52123
953
956
result = df .x .apply (func )
954
957
expected = DataFrame (
0 commit comments