Skip to content

Commit a54852a

Browse files
simonjayhawkinsjreback
authored andcommitted
TST/CLN: Remove more Panel tests (#25550)
1 parent d10bbce commit a54852a

File tree

5 files changed

+4
-799
lines changed

5 files changed

+4
-799
lines changed

Diff for: pandas/tests/indexing/common.py

+4-41
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
from warnings import catch_warnings, filterwarnings
55

66
import numpy as np
7-
import pytest
87

98
from pandas.compat import lrange
109

1110
from pandas.core.dtypes.common import is_scalar
1211

1312
from pandas import (
14-
DataFrame, Float64Index, MultiIndex, Panel, Series, UInt64Index,
15-
date_range)
13+
DataFrame, Float64Index, MultiIndex, Series, UInt64Index, date_range)
1614
from pandas.util import testing as tm
1715

1816
from pandas.io.formats.printing import pprint_thing
@@ -31,11 +29,10 @@ def _axify(obj, key, axis):
3129
return tuple(axes)
3230

3331

34-
@pytest.mark.filterwarnings("ignore:\\nPanel:FutureWarning")
3532
class Base(object):
3633
""" indexing comprehensive base class """
3734

38-
_objs = {'series', 'frame', 'panel'}
35+
_objs = {'series', 'frame'}
3936
_typs = {'ints', 'uints', 'labels', 'mixed', 'ts', 'floats', 'empty',
4037
'ts_rev', 'multi'}
4138

@@ -45,31 +42,18 @@ def setup_method(self, method):
4542
self.frame_ints = DataFrame(np.random.randn(4, 4),
4643
index=lrange(0, 8, 2),
4744
columns=lrange(0, 12, 3))
48-
with catch_warnings(record=True):
49-
self.panel_ints = Panel(np.random.rand(4, 4, 4),
50-
items=lrange(0, 8, 2),
51-
major_axis=lrange(0, 12, 3),
52-
minor_axis=lrange(0, 16, 4))
5345

5446
self.series_uints = Series(np.random.rand(4),
5547
index=UInt64Index(lrange(0, 8, 2)))
5648
self.frame_uints = DataFrame(np.random.randn(4, 4),
5749
index=UInt64Index(lrange(0, 8, 2)),
5850
columns=UInt64Index(lrange(0, 12, 3)))
59-
self.panel_uints = Panel(np.random.rand(4, 4, 4),
60-
items=UInt64Index(lrange(0, 8, 2)),
61-
major_axis=UInt64Index(lrange(0, 12, 3)),
62-
minor_axis=UInt64Index(lrange(0, 16, 4)))
6351

6452
self.series_floats = Series(np.random.rand(4),
6553
index=Float64Index(range(0, 8, 2)))
6654
self.frame_floats = DataFrame(np.random.randn(4, 4),
6755
index=Float64Index(range(0, 8, 2)),
6856
columns=Float64Index(range(0, 12, 3)))
69-
self.panel_floats = Panel(np.random.rand(4, 4, 4),
70-
items=Float64Index(range(0, 8, 2)),
71-
major_axis=Float64Index(range(0, 12, 3)),
72-
minor_axis=Float64Index(range(0, 16, 4)))
7357

7458
m_idces = [MultiIndex.from_product([[1, 2], [3, 4]]),
7559
MultiIndex.from_product([[5, 6], [7, 8]]),
@@ -80,44 +64,29 @@ def setup_method(self, method):
8064
self.frame_multi = DataFrame(np.random.randn(4, 4),
8165
index=m_idces[0],
8266
columns=m_idces[1])
83-
self.panel_multi = Panel(np.random.rand(4, 4, 4),
84-
items=m_idces[0],
85-
major_axis=m_idces[1],
86-
minor_axis=m_idces[2])
8767

8868
self.series_labels = Series(np.random.randn(4), index=list('abcd'))
8969
self.frame_labels = DataFrame(np.random.randn(4, 4),
9070
index=list('abcd'), columns=list('ABCD'))
91-
self.panel_labels = Panel(np.random.randn(4, 4, 4),
92-
items=list('abcd'),
93-
major_axis=list('ABCD'),
94-
minor_axis=list('ZYXW'))
9571

9672
self.series_mixed = Series(np.random.randn(4), index=[2, 4, 'null', 8])
9773
self.frame_mixed = DataFrame(np.random.randn(4, 4),
9874
index=[2, 4, 'null', 8])
99-
self.panel_mixed = Panel(np.random.randn(4, 4, 4),
100-
items=[2, 4, 'null', 8])
10175

10276
self.series_ts = Series(np.random.randn(4),
10377
index=date_range('20130101', periods=4))
10478
self.frame_ts = DataFrame(np.random.randn(4, 4),
10579
index=date_range('20130101', periods=4))
106-
self.panel_ts = Panel(np.random.randn(4, 4, 4),
107-
items=date_range('20130101', periods=4))
10880

10981
dates_rev = (date_range('20130101', periods=4)
11082
.sort_values(ascending=False))
11183
self.series_ts_rev = Series(np.random.randn(4),
11284
index=dates_rev)
11385
self.frame_ts_rev = DataFrame(np.random.randn(4, 4),
11486
index=dates_rev)
115-
self.panel_ts_rev = Panel(np.random.randn(4, 4, 4),
116-
items=dates_rev)
11787

11888
self.frame_empty = DataFrame({})
11989
self.series_empty = Series({})
120-
self.panel_empty = Panel({})
12190

12291
# form agglomerates
12392
for o in self._objs:
@@ -273,7 +242,7 @@ def _print(result, error=None):
273242
else:
274243
axes = list(axes)
275244
else:
276-
axes = [0, 1, 2]
245+
axes = [0, 1]
277246

278247
# check
279248
for o in objs:
@@ -296,10 +265,4 @@ def _call(obj=obj):
296265
k2 = key2
297266
_eq(t, o, a, obj, key1, k2)
298267

299-
# Panel deprecations
300-
if isinstance(obj, Panel):
301-
with catch_warnings():
302-
filterwarnings("ignore", "\nPanel*", FutureWarning)
303-
_call()
304-
else:
305-
_call()
268+
_call()

Diff for: pandas/tests/indexing/multiindex/test_panel.py

-57
This file was deleted.

Diff for: pandas/tests/indexing/test_loc.py

-24
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ def test_loc_getitem_int(self):
9595
typs=['ints', 'uints'], axes=0)
9696
self.check_result('int label', 'loc', 3, 'ix', 3,
9797
typs=['ints', 'uints'], axes=1)
98-
self.check_result('int label', 'loc', 4, 'ix', 4,
99-
typs=['ints', 'uints'], axes=2)
10098
self.check_result('int label', 'loc', 2, 'ix', 2,
10199
typs=['label'], fails=KeyError)
102100

@@ -137,14 +135,10 @@ def test_loc_getitem_label_list(self):
137135
typs=['ints', 'uints'], axes=0)
138136
self.check_result('list lbl', 'loc', [3, 6, 9], 'ix', [3, 6, 9],
139137
typs=['ints', 'uints'], axes=1)
140-
self.check_result('list lbl', 'loc', [4, 8, 12], 'ix', [4, 8, 12],
141-
typs=['ints', 'uints'], axes=2)
142138
self.check_result('list lbl', 'loc', ['a', 'b', 'd'], 'ix',
143139
['a', 'b', 'd'], typs=['labels'], axes=0)
144140
self.check_result('list lbl', 'loc', ['A', 'B', 'C'], 'ix',
145141
['A', 'B', 'C'], typs=['labels'], axes=1)
146-
self.check_result('list lbl', 'loc', ['Z', 'Y', 'W'], 'ix',
147-
['Z', 'Y', 'W'], typs=['labels'], axes=2)
148142
self.check_result('list lbl', 'loc', [2, 8, 'null'], 'ix',
149143
[2, 8, 'null'], typs=['mixed'], axes=0)
150144
self.check_result('list lbl', 'loc',
@@ -167,11 +161,6 @@ def test_loc_getitem_label_list_with_missing(self):
167161
typs=['ints', 'uints', 'floats'],
168162
axes=1, fails=KeyError)
169163

170-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
171-
self.check_result('list lbl', 'loc', [4, 8, 10], 'ix', [4, 8, 10],
172-
typs=['ints', 'uints', 'floats'],
173-
axes=2, fails=KeyError)
174-
175164
# GH 17758 - MultiIndex and missing keys
176165
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
177166
self.check_result('list lbl', 'loc', [(1, 3), (1, 4), (2, 5)],
@@ -194,17 +183,13 @@ def test_loc_getitem_label_list_fails(self):
194183
# fails
195184
self.check_result('list lbl', 'loc', [20, 30, 40], 'ix', [20, 30, 40],
196185
typs=['ints', 'uints'], axes=1, fails=KeyError)
197-
self.check_result('list lbl', 'loc', [20, 30, 40], 'ix', [20, 30, 40],
198-
typs=['ints', 'uints'], axes=2, fails=KeyError)
199186

200187
def test_loc_getitem_label_array_like(self):
201188
# array like
202189
self.check_result('array like', 'loc', Series(index=[0, 2, 4]).index,
203190
'ix', [0, 2, 4], typs=['ints', 'uints'], axes=0)
204191
self.check_result('array like', 'loc', Series(index=[3, 6, 9]).index,
205192
'ix', [3, 6, 9], typs=['ints', 'uints'], axes=1)
206-
self.check_result('array like', 'loc', Series(index=[4, 8, 12]).index,
207-
'ix', [4, 8, 12], typs=['ints', 'uints'], axes=2)
208193

209194
def test_loc_getitem_bool(self):
210195
# boolean indexers
@@ -222,8 +207,6 @@ def test_loc_getitem_int_slice(self):
222207
typs=['ints', 'uints'], axes=0)
223208
self.check_result('int slice2', 'loc', slice(3, 6), 'ix', [3, 6],
224209
typs=['ints', 'uints'], axes=1)
225-
self.check_result('int slice2', 'loc', slice(4, 8), 'ix', [4, 8],
226-
typs=['ints', 'uints'], axes=2)
227210

228211
def test_loc_to_fail(self):
229212

@@ -318,18 +301,13 @@ def test_loc_getitem_label_slice(self):
318301
'ix', slice('a', 'c'), typs=['labels'], axes=0)
319302
self.check_result('lab slice', 'loc', slice('A', 'C'),
320303
'ix', slice('A', 'C'), typs=['labels'], axes=1)
321-
self.check_result('lab slice', 'loc', slice('W', 'Z'),
322-
'ix', slice('W', 'Z'), typs=['labels'], axes=2)
323304

324305
self.check_result('ts slice', 'loc', slice('20130102', '20130104'),
325306
'ix', slice('20130102', '20130104'),
326307
typs=['ts'], axes=0)
327308
self.check_result('ts slice', 'loc', slice('20130102', '20130104'),
328309
'ix', slice('20130102', '20130104'),
329310
typs=['ts'], axes=1, fails=TypeError)
330-
self.check_result('ts slice', 'loc', slice('20130102', '20130104'),
331-
'ix', slice('20130102', '20130104'),
332-
typs=['ts'], axes=2, fails=TypeError)
333311

334312
# GH 14316
335313
self.check_result('ts slice rev', 'loc', slice('20130104', '20130102'),
@@ -339,8 +317,6 @@ def test_loc_getitem_label_slice(self):
339317
typs=['mixed'], axes=0, fails=TypeError)
340318
self.check_result('mixed slice', 'loc', slice(2, 8), 'ix', slice(2, 8),
341319
typs=['mixed'], axes=1, fails=KeyError)
342-
self.check_result('mixed slice', 'loc', slice(2, 8), 'ix', slice(2, 8),
343-
typs=['mixed'], axes=2, fails=KeyError)
344320

345321
self.check_result('mixed slice', 'loc', slice(2, 4, 2), 'ix', slice(
346322
2, 4, 2), typs=['mixed'], axes=0, fails=TypeError)

Diff for: pandas/tests/indexing/test_panel.py

-104
This file was deleted.

0 commit comments

Comments
 (0)