Skip to content

Commit 8ab1d54

Browse files
jbrockmendelPingviinituutti
authored andcommitted
REF: Remove many Panel tests (pandas-dev#25191)
1 parent 796907b commit 8ab1d54

File tree

14 files changed

+19
-821
lines changed

14 files changed

+19
-821
lines changed

pandas/core/internals/blocks.py

-14
Original file line numberDiff line numberDiff line change
@@ -268,20 +268,6 @@ def _slice(self, slicer):
268268
""" return a slice of my values """
269269
return self.values[slicer]
270270

271-
def reshape_nd(self, labels, shape, ref_items):
272-
"""
273-
Parameters
274-
----------
275-
labels : list of new axis labels
276-
shape : new shape
277-
ref_items : new ref_items
278-
279-
return a new block that is transformed to a nd block
280-
"""
281-
return _block2d_to_blocknd(values=self.get_values().T,
282-
placement=self.mgr_locs, shape=shape,
283-
labels=labels, ref_items=ref_items)
284-
285271
def getitem_block(self, slicer, new_mgr_locs=None):
286272
"""
287273
Perform __getitem__-like, return result as block.

pandas/core/internals/managers.py

-4
Original file line numberDiff line numberDiff line change
@@ -584,10 +584,6 @@ def comp(s, regex=False):
584584
bm._consolidate_inplace()
585585
return bm
586586

587-
def reshape_nd(self, axes, **kwargs):
588-
""" a 2d-nd reshape operation on a BlockManager """
589-
return self.apply('reshape_nd', axes=axes, **kwargs)
590-
591587
def is_consolidated(self):
592588
"""
593589
Return True if more than one block with the same dtype

pandas/io/pytables.py

-19
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ class DuplicateWarning(Warning):
197197
u'appendable_multiseries': 'AppendableMultiSeriesTable',
198198
u'appendable_frame': 'AppendableFrameTable',
199199
u'appendable_multiframe': 'AppendableMultiFrameTable',
200-
u'appendable_panel': 'AppendablePanelTable',
201200
u'worm': 'WORMTable',
202201
u'legacy_frame': 'LegacyFrameTable',
203202
u'legacy_panel': 'LegacyPanelTable',
@@ -4420,24 +4419,6 @@ def read(self, **kwargs):
44204419
return df
44214420

44224421

4423-
class AppendablePanelTable(AppendableTable):
4424-
4425-
""" suppor the new appendable table formats """
4426-
table_type = u'appendable_panel'
4427-
ndim = 3
4428-
obj_type = Panel
4429-
4430-
def get_object(self, obj):
4431-
""" these are written transposed """
4432-
if self.is_transposed:
4433-
obj = obj.transpose(*self.data_orientation)
4434-
return obj
4435-
4436-
@property
4437-
def is_transposed(self):
4438-
return self.data_orientation != tuple(range(self.ndim))
4439-
4440-
44414422
def _reindex_axis(obj, axis, labels, other=None):
44424423
ax = obj._get_axis(axis)
44434424
labels = ensure_index(labels)

pandas/tests/dtypes/test_missing.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from datetime import datetime
44
from decimal import Decimal
5-
from warnings import catch_warnings, filterwarnings, simplefilter
5+
from warnings import catch_warnings, filterwarnings
66

77
import numpy as np
88
import pytest
@@ -94,15 +94,6 @@ def test_isna_isnull(self, isna_f):
9494
expected = df.apply(isna_f)
9595
tm.assert_frame_equal(result, expected)
9696

97-
# panel
98-
with catch_warnings(record=True):
99-
simplefilter("ignore", FutureWarning)
100-
for p in [tm.makePanel(), tm.makePeriodPanel(),
101-
tm.add_nans(tm.makePanel())]:
102-
result = isna_f(p)
103-
expected = p.apply(isna_f)
104-
tm.assert_panel_equal(result, expected)
105-
10697
def test_isna_lists(self):
10798
result = isna([[False]])
10899
exp = np.array([[False]])

pandas/tests/frame/test_query_eval.py

-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from pandas import DataFrame, Index, MultiIndex, Series, date_range
1515
from pandas.core.computation.check import _NUMEXPR_INSTALLED
1616
from pandas.tests.frame.common import TestData
17-
import pandas.util.testing as tm
1817
from pandas.util.testing import (
1918
assert_frame_equal, assert_series_equal, makeCustomDataframe as mkdf)
2019

@@ -355,13 +354,6 @@ def to_series(mi, level):
355354
else:
356355
raise AssertionError("object must be a Series or Index")
357356

358-
@pytest.mark.filterwarnings("ignore::FutureWarning")
359-
def test_raise_on_panel_with_multiindex(self, parser, engine):
360-
p = tm.makePanel(7)
361-
p.items = tm.makeCustomIndex(len(p.items), nlevels=2)
362-
with pytest.raises(NotImplementedError):
363-
pd.eval('p + 1', parser=parser, engine=engine)
364-
365357

366358
@td.skip_if_no_ne
367359
class TestDataFrameQueryNumExprPandas(object):

pandas/tests/groupby/test_groupby.py

-20
Original file line numberDiff line numberDiff line change
@@ -1218,26 +1218,6 @@ def test_groupby_nat_exclude():
12181218
grouped.get_group(pd.NaT)
12191219

12201220

1221-
@pytest.mark.filterwarnings("ignore:\\nPanel:FutureWarning")
1222-
def test_sparse_friendly(df):
1223-
sdf = df[['C', 'D']].to_sparse()
1224-
panel = tm.makePanel()
1225-
tm.add_nans(panel)
1226-
1227-
def _check_work(gp):
1228-
gp.mean()
1229-
gp.agg(np.mean)
1230-
dict(iter(gp))
1231-
1232-
# it works!
1233-
_check_work(sdf.groupby(lambda x: x // 2))
1234-
_check_work(sdf['C'].groupby(lambda x: x // 2))
1235-
_check_work(sdf.groupby(df['A']))
1236-
1237-
# do this someday
1238-
# _check_work(panel.groupby(lambda x: x.month, axis=1))
1239-
1240-
12411221
def test_groupby_2d_malformed():
12421222
d = DataFrame(index=lrange(2))
12431223
d['group'] = ['g1', 'g2']

pandas/tests/indexing/test_chaining_and_caching.py

-7
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ def check(result, expected):
357357
check(result4, expected)
358358

359359
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
360-
@pytest.mark.filterwarnings("ignore:\\nPanel:FutureWarning")
361360
def test_cache_updating(self):
362361
# GH 4939, make sure to update the cache on setitem
363362

@@ -367,12 +366,6 @@ def test_cache_updating(self):
367366
assert "Hello Friend" in df['A'].index
368367
assert "Hello Friend" in df['B'].index
369368

370-
panel = tm.makePanel()
371-
panel.ix[0] # get first item into cache
372-
panel.ix[:, :, 'A+1'] = panel.ix[:, :, 'A'] + 1
373-
assert "A+1" in panel.ix[0].columns
374-
assert "A+1" in panel.ix[1].columns
375-
376369
# 10264
377370
df = DataFrame(np.zeros((5, 5), dtype='int64'), columns=[
378371
'a', 'b', 'c', 'd', 'e'], index=range(5))

pandas/tests/io/test_excel.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from functools import partial
66
import os
77
import warnings
8-
from warnings import catch_warnings
98

109
import numpy as np
1110
from numpy import nan
@@ -2382,15 +2381,12 @@ def check_called(func):
23822381
assert isinstance(writer, DummyClass)
23832382
df = tm.makeCustomDataframe(1, 1)
23842383

2385-
with catch_warnings(record=True):
2386-
panel = tm.makePanel()
2387-
func = lambda: df.to_excel('something.test')
2388-
check_called(func)
2389-
check_called(lambda: panel.to_excel('something.test'))
2390-
check_called(lambda: df.to_excel('something.xlsx'))
2391-
check_called(
2392-
lambda: df.to_excel(
2393-
'something.xls', engine='dummy'))
2384+
func = lambda: df.to_excel('something.test')
2385+
check_called(func)
2386+
check_called(lambda: df.to_excel('something.xlsx'))
2387+
check_called(
2388+
lambda: df.to_excel(
2389+
'something.xls', engine='dummy'))
23942390

23952391

23962392
@pytest.mark.parametrize('engine', [

0 commit comments

Comments
 (0)