Skip to content

REF: Remove many Panel tests #25191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,20 +268,6 @@ def _slice(self, slicer):
""" return a slice of my values """
return self.values[slicer]

def reshape_nd(self, labels, shape, ref_items):
"""
Parameters
----------
labels : list of new axis labels
shape : new shape
ref_items : new ref_items

return a new block that is transformed to a nd block
"""
return _block2d_to_blocknd(values=self.get_values().T,
placement=self.mgr_locs, shape=shape,
labels=labels, ref_items=ref_items)

def getitem_block(self, slicer, new_mgr_locs=None):
"""
Perform __getitem__-like, return result as block.
Expand Down
4 changes: 0 additions & 4 deletions pandas/core/internals/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,6 @@ def comp(s, regex=False):
bm._consolidate_inplace()
return bm

def reshape_nd(self, axes, **kwargs):
""" a 2d-nd reshape operation on a BlockManager """
return self.apply('reshape_nd', axes=axes, **kwargs)

def is_consolidated(self):
"""
Return True if more than one block with the same dtype
Expand Down
19 changes: 0 additions & 19 deletions pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ class DuplicateWarning(Warning):
u'appendable_multiseries': 'AppendableMultiSeriesTable',
u'appendable_frame': 'AppendableFrameTable',
u'appendable_multiframe': 'AppendableMultiFrameTable',
u'appendable_panel': 'AppendablePanelTable',
u'worm': 'WORMTable',
u'legacy_frame': 'LegacyFrameTable',
u'legacy_panel': 'LegacyPanelTable',
Expand Down Expand Up @@ -4420,24 +4419,6 @@ def read(self, **kwargs):
return df


class AppendablePanelTable(AppendableTable):

""" suppor the new appendable table formats """
table_type = u'appendable_panel'
ndim = 3
obj_type = Panel

def get_object(self, obj):
""" these are written transposed """
if self.is_transposed:
obj = obj.transpose(*self.data_orientation)
return obj

@property
def is_transposed(self):
return self.data_orientation != tuple(range(self.ndim))


def _reindex_axis(obj, axis, labels, other=None):
ax = obj._get_axis(axis)
labels = ensure_index(labels)
Expand Down
11 changes: 1 addition & 10 deletions pandas/tests/dtypes/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from datetime import datetime
from decimal import Decimal
from warnings import catch_warnings, filterwarnings, simplefilter
from warnings import catch_warnings, filterwarnings

import numpy as np
import pytest
Expand Down Expand Up @@ -94,15 +94,6 @@ def test_isna_isnull(self, isna_f):
expected = df.apply(isna_f)
tm.assert_frame_equal(result, expected)

# panel
with catch_warnings(record=True):
simplefilter("ignore", FutureWarning)
for p in [tm.makePanel(), tm.makePeriodPanel(),
tm.add_nans(tm.makePanel())]:
result = isna_f(p)
expected = p.apply(isna_f)
tm.assert_panel_equal(result, expected)

def test_isna_lists(self):
result = isna([[False]])
exp = np.array([[False]])
Expand Down
8 changes: 0 additions & 8 deletions pandas/tests/frame/test_query_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from pandas import DataFrame, Index, MultiIndex, Series, date_range
from pandas.core.computation.check import _NUMEXPR_INSTALLED
from pandas.tests.frame.common import TestData
import pandas.util.testing as tm
from pandas.util.testing import (
assert_frame_equal, assert_series_equal, makeCustomDataframe as mkdf)

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

@pytest.mark.filterwarnings("ignore::FutureWarning")
def test_raise_on_panel_with_multiindex(self, parser, engine):
p = tm.makePanel(7)
p.items = tm.makeCustomIndex(len(p.items), nlevels=2)
with pytest.raises(NotImplementedError):
pd.eval('p + 1', parser=parser, engine=engine)


@td.skip_if_no_ne
class TestDataFrameQueryNumExprPandas(object):
Expand Down
20 changes: 0 additions & 20 deletions pandas/tests/groupby/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1219,26 +1219,6 @@ def test_groupby_nat_exclude():
grouped.get_group(pd.NaT)


@pytest.mark.filterwarnings("ignore:\\nPanel:FutureWarning")
def test_sparse_friendly(df):
sdf = df[['C', 'D']].to_sparse()
panel = tm.makePanel()
tm.add_nans(panel)

def _check_work(gp):
gp.mean()
gp.agg(np.mean)
dict(iter(gp))

# it works!
_check_work(sdf.groupby(lambda x: x // 2))
_check_work(sdf['C'].groupby(lambda x: x // 2))
_check_work(sdf.groupby(df['A']))

# do this someday
# _check_work(panel.groupby(lambda x: x.month, axis=1))


def test_groupby_2d_malformed():
d = DataFrame(index=lrange(2))
d['group'] = ['g1', 'g2']
Expand Down
7 changes: 0 additions & 7 deletions pandas/tests/indexing/test_chaining_and_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ def check(result, expected):
check(result4, expected)

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

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

panel = tm.makePanel()
panel.ix[0] # get first item into cache
panel.ix[:, :, 'A+1'] = panel.ix[:, :, 'A'] + 1
assert "A+1" in panel.ix[0].columns
assert "A+1" in panel.ix[1].columns

# 10264
df = DataFrame(np.zeros((5, 5), dtype='int64'), columns=[
'a', 'b', 'c', 'd', 'e'], index=range(5))
Expand Down
16 changes: 6 additions & 10 deletions pandas/tests/io/test_excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from functools import partial
import os
import warnings
from warnings import catch_warnings

import numpy as np
from numpy import nan
Expand Down Expand Up @@ -2382,15 +2381,12 @@ def check_called(func):
assert isinstance(writer, DummyClass)
df = tm.makeCustomDataframe(1, 1)

with catch_warnings(record=True):
panel = tm.makePanel()
func = lambda: df.to_excel('something.test')
check_called(func)
check_called(lambda: panel.to_excel('something.test'))
check_called(lambda: df.to_excel('something.xlsx'))
check_called(
lambda: df.to_excel(
'something.xls', engine='dummy'))
func = lambda: df.to_excel('something.test')
check_called(func)
check_called(lambda: df.to_excel('something.xlsx'))
check_called(
lambda: df.to_excel(
'something.xls', engine='dummy'))


@pytest.mark.parametrize('engine', [
Expand Down
Loading