@@ -381,15 +381,16 @@ def test_agg_apply_evaluate_lambdas_the_same(string_series):
381
381
def test_with_nested_series (datetime_series ):
382
382
# GH 2316
383
383
# .agg with a reducer and a transform, what to do
384
- with tm .assert_produces_warning (FutureWarning , match = "converting list of Series" ):
384
+ msg = "Returning a DataFrame from Series.apply when the supplied function"
385
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
385
386
# GH52123
386
387
result = datetime_series .apply (
387
388
lambda x : Series ([x , x ** 2 ], index = ["x" , "x^2" ])
388
389
)
389
390
expected = DataFrame ({"x" : datetime_series , "x^2" : datetime_series ** 2 })
390
391
tm .assert_frame_equal (result , expected )
391
392
392
- with tm .assert_produces_warning (FutureWarning , match = "converting list of Series" ):
393
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
393
394
# GH52123
394
395
result = datetime_series .agg (lambda x : Series ([x , x ** 2 ], index = ["x" , "x^2" ]))
395
396
tm .assert_frame_equal (result , expected )
@@ -863,7 +864,8 @@ def test_apply_series_on_date_time_index_aware_series(dti, exp, aware):
863
864
index = dti .tz_localize ("UTC" ).index
864
865
else :
865
866
index = dti .index
866
- with tm .assert_produces_warning (FutureWarning , match = "converting list of Series" ):
867
+ msg = "Returning a DataFrame from Series.apply when the supplied function"
868
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
867
869
# GH52123
868
870
result = Series (index ).apply (lambda x : Series ([1 , 2 ]))
869
871
tm .assert_frame_equal (result , exp )
@@ -975,7 +977,8 @@ def test_apply_retains_column_name():
975
977
# GH 16380
976
978
df = DataFrame ({"x" : range (3 )}, Index (range (3 ), name = "x" ))
977
979
func = lambda x : Series (range (x + 1 ), Index (range (x + 1 ), name = "y" ))
978
- with tm .assert_produces_warning (FutureWarning , match = "converting list of Series" ):
980
+ msg = "Returning a DataFrame from Series.apply when the supplied function"
981
+ with tm .assert_produces_warning (FutureWarning , match = msg ):
979
982
# GH52123
980
983
result = df .x .apply (func )
981
984
expected = DataFrame (
0 commit comments