@@ -1570,11 +1570,6 @@ def _is_level_reference(self, key, axis=0):
1570
1570
"""
1571
1571
axis = self ._get_axis_number (axis )
1572
1572
1573
- if self .ndim > 2 :
1574
- raise NotImplementedError (
1575
- "_is_level_reference is not implemented for {type}"
1576
- .format (type = type (self )))
1577
-
1578
1573
return (key is not None and
1579
1574
is_hashable (key ) and
1580
1575
key in self .axes [axis ].names and
@@ -1600,11 +1595,6 @@ def _is_label_reference(self, key, axis=0):
1600
1595
-------
1601
1596
is_label: bool
1602
1597
"""
1603
- if self .ndim > 2 :
1604
- raise NotImplementedError (
1605
- "_is_label_reference is not implemented for {type}"
1606
- .format (type = type (self )))
1607
-
1608
1598
axis = self ._get_axis_number (axis )
1609
1599
other_axes = (ax for ax in range (self ._AXIS_LEN ) if ax != axis )
1610
1600
@@ -1632,12 +1622,6 @@ def _is_label_or_level_reference(self, key, axis=0):
1632
1622
-------
1633
1623
is_label_or_level: bool
1634
1624
"""
1635
-
1636
- if self .ndim > 2 :
1637
- raise NotImplementedError (
1638
- "_is_label_or_level_reference is not implemented for {type}"
1639
- .format (type = type (self )))
1640
-
1641
1625
return (self ._is_level_reference (key , axis = axis ) or
1642
1626
self ._is_label_reference (key , axis = axis ))
1643
1627
@@ -1659,11 +1643,6 @@ def _check_label_or_level_ambiguity(self, key, axis=0):
1659
1643
------
1660
1644
ValueError: `key` is ambiguous
1661
1645
"""
1662
- if self .ndim > 2 :
1663
- raise NotImplementedError (
1664
- "_check_label_or_level_ambiguity is not implemented for {type}"
1665
- .format (type = type (self )))
1666
-
1667
1646
axis = self ._get_axis_number (axis )
1668
1647
other_axes = (ax for ax in range (self ._AXIS_LEN ) if ax != axis )
1669
1648
@@ -1724,11 +1703,6 @@ def _get_label_or_level_values(self, key, axis=0):
1724
1703
if `key` is ambiguous. This will become an ambiguity error in a
1725
1704
future version
1726
1705
"""
1727
- if self .ndim > 2 :
1728
- raise NotImplementedError (
1729
- "_get_label_or_level_values is not implemented for {type}"
1730
- .format (type = type (self )))
1731
-
1732
1706
axis = self ._get_axis_number (axis )
1733
1707
other_axes = [ax for ax in range (self ._AXIS_LEN ) if ax != axis ]
1734
1708
@@ -1787,11 +1761,6 @@ def _drop_labels_or_levels(self, keys, axis=0):
1787
1761
ValueError
1788
1762
if any `keys` match neither a label nor a level
1789
1763
"""
1790
- if self .ndim > 2 :
1791
- raise NotImplementedError (
1792
- "_drop_labels_or_levels is not implemented for {type}"
1793
- .format (type = type (self )))
1794
-
1795
1764
axis = self ._get_axis_number (axis )
1796
1765
1797
1766
# Validate keys
@@ -2781,7 +2750,6 @@ class (index) object 'bird' 'bird' 'mammal' 'mammal'
2781
2750
Data variables:
2782
2751
speed (date, animal) int64 350 18 361 15
2783
2752
"""
2784
-
2785
2753
try :
2786
2754
import xarray
2787
2755
except ImportError :
@@ -2794,15 +2762,9 @@ class (index) object 'bird' 'bird' 'mammal' 'mammal'
2794
2762
2795
2763
if self .ndim == 1 :
2796
2764
return xarray .DataArray .from_series (self )
2797
- elif self . ndim == 2 :
2765
+ else :
2798
2766
return xarray .Dataset .from_dataframe (self )
2799
2767
2800
- # > 2 dims
2801
- coords = [(a , self ._get_axis (a )) for a in self ._AXIS_ORDERS ]
2802
- return xarray .DataArray (self ,
2803
- coords = coords ,
2804
- )
2805
-
2806
2768
def to_latex (self , buf = None , columns = None , col_space = None , header = True ,
2807
2769
index = True , na_rep = 'NaN' , formatters = None , float_format = None ,
2808
2770
sparsify = None , index_names = True , bold_rows = False ,
@@ -5692,11 +5654,7 @@ def astype(self, dtype, copy=True, errors='raise', **kwargs):
5692
5654
'the key in Series dtype mappings.' )
5693
5655
new_type = dtype [self .name ]
5694
5656
return self .astype (new_type , copy , errors , ** kwargs )
5695
- elif self .ndim > 2 :
5696
- raise NotImplementedError (
5697
- 'astype() only accepts a dtype arg of type dict when '
5698
- 'invoked on Series and DataFrames.'
5699
- )
5657
+
5700
5658
for col_name in dtype .keys ():
5701
5659
if col_name not in self :
5702
5660
raise KeyError ('Only a column name can be used for the '
@@ -6051,26 +6009,10 @@ def fillna(self, value=None, method=None, axis=None, inplace=False,
6051
6009
6052
6010
return result
6053
6011
6054
- # > 3d
6055
- if self .ndim > 3 :
6056
- raise NotImplementedError ('Cannot fillna with a method for > '
6057
- '3dims' )
6058
-
6059
- # 3d
6060
- elif self .ndim == 3 :
6061
- # fill in 2d chunks
6062
- result = {col : s .fillna (method = method , value = value )
6063
- for col , s in self .iteritems ()}
6064
- prelim_obj = self ._constructor .from_dict (result )
6065
- new_obj = prelim_obj .__finalize__ (self )
6066
- new_data = new_obj ._data
6067
-
6068
- else :
6069
- # 2d or less
6070
- new_data = self ._data .interpolate (method = method , axis = axis ,
6071
- limit = limit , inplace = inplace ,
6072
- coerce = True ,
6073
- downcast = downcast )
6012
+ new_data = self ._data .interpolate (method = method , axis = axis ,
6013
+ limit = limit , inplace = inplace ,
6014
+ coerce = True ,
6015
+ downcast = downcast )
6074
6016
else :
6075
6017
if len (self ._get_axis (axis )) == 0 :
6076
6018
return self
@@ -6782,9 +6724,6 @@ def interpolate(self, method='linear', axis=0, limit=None, inplace=False,
6782
6724
"""
6783
6725
inplace = validate_bool_kwarg (inplace , 'inplace' )
6784
6726
6785
- if self .ndim > 2 :
6786
- raise NotImplementedError ("Interpolate has not been implemented " )
6787
-
6788
6727
if axis == 0 :
6789
6728
ax = self ._info_axis_name
6790
6729
_maybe_transposed_self = self
@@ -6964,9 +6903,6 @@ def asof(self, where, subset=None):
6964
6903
if is_series :
6965
6904
if subset is not None :
6966
6905
raise ValueError ("subset is not valid for Series" )
6967
- elif self .ndim > 2 :
6968
- raise NotImplementedError ("asof is not implemented "
6969
- "for {type}" .format (type = type (self )))
6970
6906
else :
6971
6907
if subset is None :
6972
6908
subset = self .columns
@@ -8373,10 +8309,6 @@ def rank(self, axis=0, method='average', numeric_only=None,
8373
8309
"""
8374
8310
axis = self ._get_axis_number (axis )
8375
8311
8376
- if self .ndim > 2 :
8377
- msg = "rank does not make sense when ndim > 2"
8378
- raise NotImplementedError (msg )
8379
-
8380
8312
if na_option not in {'keep' , 'top' , 'bottom' }:
8381
8313
msg = "na_option must be one of 'keep', 'top', or 'bottom'"
8382
8314
raise ValueError (msg )
0 commit comments