Skip to content

Remove pd.Panel checks #6145

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 3 commits into from
Jan 9, 2022
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
3 changes: 3 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ Internal Changes
- Replace ``distutils.version`` with ``packaging.version`` (:issue:`6092`).
By `Mathias Hauser <https://github.com/mathause>`_.

- Removed internal checks for ``pd.Panel`` (:issue:`6145`).
By `Matthew Roeschke <https://github.com/mroeschke>`_.


.. _whats-new.0.20.2:

Expand Down
3 changes: 0 additions & 3 deletions xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
groupby,
indexing,
ops,
pdcompat,
resample,
rolling,
utils,
Expand Down Expand Up @@ -400,8 +399,6 @@ def __init__(
coords = [data.index, data.columns]
elif isinstance(data, (pd.Index, IndexVariable)):
coords = [data]
elif isinstance(data, pdcompat.Panel):
coords = [data.items, data.major_axis, data.minor_axis]

if dims is None:
dims = getattr(data, "dims", getattr(coords, "dims", None))
Expand Down
4 changes: 2 additions & 2 deletions xarray/core/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import pandas as pd

from . import dtypes, pdcompat
from . import dtypes
from .alignment import deep_align
from .duck_array_ops import lazy_array_equiv
from .indexes import Index, PandasIndex
Expand All @@ -45,7 +45,7 @@
CoercibleMapping = Union[Dataset, Mapping[Any, CoercibleValue]]


PANDAS_TYPES = (pd.Series, pd.DataFrame, pdcompat.Panel)
PANDAS_TYPES = (pd.Series, pd.DataFrame)

_VALID_COMPAT = Frozen(
{
Expand Down
14 changes: 0 additions & 14 deletions xarray/core/pdcompat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# The remove_unused_levels defined here was copied based on the source code
# defined in pandas.core.indexes.muli.py

# For reference, here is a copy of the pandas copyright notice:

# (c) 2011-2012, Lambda Foundry, Inc. and PyData Development Team
Expand Down Expand Up @@ -37,17 +34,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import pandas as pd
from packaging.version import Version

# allow ourselves to type checks for Panel even after it's removed
if Version(pd.__version__) < Version("0.25.0"):
Panel = pd.Panel
else:

class Panel: # type: ignore[no-redef]
pass


def count_not_none(*args) -> int:
"""Compute the number of non-None arguments.
Expand Down