16
16
17
17
import pandas as pd
18
18
from pandas import (
19
- Categorical , DataFrame , DatetimeIndex , Index , MultiIndex , Panel , Series ,
19
+ Categorical , DataFrame , DatetimeIndex , Index , MultiIndex , Series ,
20
20
Timestamp , concat , date_range , isna , read_csv )
21
21
from pandas .tests .extension .decimal import to_decimal
22
22
from pandas .util import testing as tm
@@ -196,9 +196,8 @@ def test_concatlike_same_dtypes(self):
196
196
tm .assert_series_equal (res , exp , check_index_type = True )
197
197
198
198
# 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" )
202
201
with pytest .raises (TypeError , match = msg ):
203
202
pd .Series (vals1 ).append (vals2 )
204
203
@@ -1534,33 +1533,6 @@ def test_dtype_coerceion(self):
1534
1533
result = concat ([df .iloc [[0 ]], df .iloc [[1 ]]])
1535
1534
tm .assert_series_equal (result .dtypes , df .dtypes )
1536
1535
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
-
1564
1536
def test_concat_series (self ):
1565
1537
1566
1538
ts = tm .makeTimeSeries ()
@@ -1781,9 +1753,8 @@ def test_concat_invalid(self):
1781
1753
1782
1754
# trying to concat a ndframe with a non-ndframe
1783
1755
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" )
1787
1758
for obj in [1 , dict (), [1 , 2 ], (1 , 2 )]:
1788
1759
with pytest .raises (TypeError , match = msg .format (type (obj ))):
1789
1760
concat ([df1 , obj ])
@@ -2400,9 +2371,8 @@ def test_concat_different_extension_dtypes_upcasts(self):
2400
2371
tm .assert_series_equal (result , expected )
2401
2372
2402
2373
2403
- @pytest .mark .parametrize ('pdt' , [pd .Series , pd .DataFrame , pd . Panel ])
2374
+ @pytest .mark .parametrize ('pdt' , [pd .Series , pd .DataFrame ])
2404
2375
@pytest .mark .parametrize ('dt' , np .sctypes ['float' ])
2405
- @pytest .mark .filterwarnings ("ignore:\\ nPanel:FutureWarning" )
2406
2376
def test_concat_no_unnecessary_upcast (dt , pdt ):
2407
2377
# GH 13247
2408
2378
dims = pdt ().ndim
@@ -2413,9 +2383,8 @@ def test_concat_no_unnecessary_upcast(dt, pdt):
2413
2383
assert x .values .dtype == dt
2414
2384
2415
2385
2416
- @pytest .mark .parametrize ('pdt' , [pd .Series , pd .DataFrame , pd . Panel ])
2386
+ @pytest .mark .parametrize ('pdt' , [pd .Series , pd .DataFrame ])
2417
2387
@pytest .mark .parametrize ('dt' , np .sctypes ['int' ])
2418
- @pytest .mark .filterwarnings ("ignore:\\ nPanel:FutureWarning" )
2419
2388
def test_concat_will_upcast (dt , pdt ):
2420
2389
with catch_warnings (record = True ):
2421
2390
dims = pdt ().ndim
0 commit comments