Skip to content

Commit a98309c

Browse files
authored
Remove pd.Panel checks (#6145)
* Remove pd.Panel checks * Remove unused imports * Add whatsnew
1 parent e056cac commit a98309c

File tree

4 files changed

+5
-19
lines changed

4 files changed

+5
-19
lines changed

doc/whats-new.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ Internal Changes
6161
- Replace ``distutils.version`` with ``packaging.version`` (:issue:`6092`).
6262
By `Mathias Hauser <https://github.com/mathause>`_.
6363

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

6568
.. _whats-new.0.20.2:
6669

xarray/core/dataarray.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
groupby,
3333
indexing,
3434
ops,
35-
pdcompat,
3635
resample,
3736
rolling,
3837
utils,
@@ -400,8 +399,6 @@ def __init__(
400399
coords = [data.index, data.columns]
401400
elif isinstance(data, (pd.Index, IndexVariable)):
402401
coords = [data]
403-
elif isinstance(data, pdcompat.Panel):
404-
coords = [data.items, data.major_axis, data.minor_axis]
405402

406403
if dims is None:
407404
dims = getattr(data, "dims", getattr(coords, "dims", None))

xarray/core/merge.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import pandas as pd
2121

22-
from . import dtypes, pdcompat
22+
from . import dtypes
2323
from .alignment import deep_align
2424
from .duck_array_ops import lazy_array_equiv
2525
from .indexes import Index, PandasIndex
@@ -45,7 +45,7 @@
4545
CoercibleMapping = Union[Dataset, Mapping[Any, CoercibleValue]]
4646

4747

48-
PANDAS_TYPES = (pd.Series, pd.DataFrame, pdcompat.Panel)
48+
PANDAS_TYPES = (pd.Series, pd.DataFrame)
4949

5050
_VALID_COMPAT = Frozen(
5151
{

xarray/core/pdcompat.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# The remove_unused_levels defined here was copied based on the source code
2-
# defined in pandas.core.indexes.muli.py
3-
41
# For reference, here is a copy of the pandas copyright notice:
52

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

40-
import pandas as pd
41-
from packaging.version import Version
42-
43-
# allow ourselves to type checks for Panel even after it's removed
44-
if Version(pd.__version__) < Version("0.25.0"):
45-
Panel = pd.Panel
46-
else:
47-
48-
class Panel: # type: ignore[no-redef]
49-
pass
50-
5137

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

0 commit comments

Comments
 (0)