1616
1717import pandas as pd
1818from pandas import (
19- Categorical , DataFrame , DatetimeIndex , Index , MultiIndex , Panel , Series ,
19+ Categorical , DataFrame , DatetimeIndex , Index , MultiIndex , Series ,
2020 Timestamp , concat , date_range , isna , read_csv )
2121from pandas .tests .extension .decimal import to_decimal
2222from pandas .util import testing as tm
@@ -196,9 +196,8 @@ def test_concatlike_same_dtypes(self):
196196 tm .assert_series_equal (res , exp , check_index_type = True )
197197
198198 # cannot append non-index
199- msg = (r'cannot concatenate object of type \"(.+?)\";'
200- ' only pd.Series, pd.DataFrame, and pd.Panel'
201- r' \(deprecated\) objs are valid' )
199+ msg = (r"cannot concatenate object of type '.+';"
200+ " only Series and DataFrame objs are valid" )
202201 with pytest .raises (TypeError , match = msg ):
203202 pd .Series (vals1 ).append (vals2 )
204203
@@ -1534,33 +1533,6 @@ def test_dtype_coerceion(self):
15341533 result = concat ([df .iloc [[0 ]], df .iloc [[1 ]]])
15351534 tm .assert_series_equal (result .dtypes , df .dtypes )
15361535
1537- @pytest .mark .filterwarnings ("ignore:\\ nPanel:FutureWarning" )
1538- # Panel.rename warning we don't care about
1539- @pytest .mark .filterwarnings ("ignore:Using:FutureWarning" )
1540- def test_panel_concat_buglet (self , sort ):
1541- # #2257
1542- def make_panel ():
1543- index = 5
1544- cols = 3
1545-
1546- def df ():
1547- return DataFrame (np .random .randn (index , cols ),
1548- index = ["I%s" % i for i in range (index )],
1549- columns = ["C%s" % i for i in range (cols )])
1550- return Panel ({"Item%s" % x : df () for x in ['A' , 'B' , 'C' ]})
1551-
1552- panel1 = make_panel ()
1553- panel2 = make_panel ()
1554-
1555- panel2 = panel2 .rename (major_axis = {x : "%s_1" % x
1556- for x in panel2 .major_axis })
1557-
1558- panel3 = panel2 .rename (major_axis = lambda x : '%s_1' % x )
1559- panel3 = panel3 .rename (minor_axis = lambda x : '%s_1' % x )
1560-
1561- # it works!
1562- concat ([panel1 , panel3 ], axis = 1 , verify_integrity = True , sort = sort )
1563-
15641536 def test_concat_series (self ):
15651537
15661538 ts = tm .makeTimeSeries ()
@@ -1781,9 +1753,8 @@ def test_concat_invalid(self):
17811753
17821754 # trying to concat a ndframe with a non-ndframe
17831755 df1 = mkdf (10 , 2 )
1784- msg = ('cannot concatenate object of type "{}";'
1785- ' only pd.Series, pd.DataFrame, and pd.Panel'
1786- r' \(deprecated\) objs are valid' )
1756+ msg = ("cannot concatenate object of type '{}';"
1757+ " only Series and DataFrame objs are valid" )
17871758 for obj in [1 , dict (), [1 , 2 ], (1 , 2 )]:
17881759 with pytest .raises (TypeError , match = msg .format (type (obj ))):
17891760 concat ([df1 , obj ])
@@ -2400,9 +2371,8 @@ def test_concat_different_extension_dtypes_upcasts(self):
24002371 tm .assert_series_equal (result , expected )
24012372
24022373
2403- @pytest .mark .parametrize ('pdt' , [pd .Series , pd .DataFrame , pd . Panel ])
2374+ @pytest .mark .parametrize ('pdt' , [pd .Series , pd .DataFrame ])
24042375@pytest .mark .parametrize ('dt' , np .sctypes ['float' ])
2405- @pytest .mark .filterwarnings ("ignore:\\ nPanel:FutureWarning" )
24062376def test_concat_no_unnecessary_upcast (dt , pdt ):
24072377 # GH 13247
24082378 dims = pdt ().ndim
@@ -2413,9 +2383,8 @@ def test_concat_no_unnecessary_upcast(dt, pdt):
24132383 assert x .values .dtype == dt
24142384
24152385
2416- @pytest .mark .parametrize ('pdt' , [pd .Series , pd .DataFrame , pd . Panel ])
2386+ @pytest .mark .parametrize ('pdt' , [pd .Series , pd .DataFrame ])
24172387@pytest .mark .parametrize ('dt' , np .sctypes ['int' ])
2418- @pytest .mark .filterwarnings ("ignore:\\ nPanel:FutureWarning" )
24192388def test_concat_will_upcast (dt , pdt ):
24202389 with catch_warnings (record = True ):
24212390 dims = pdt ().ndim
0 commit comments