64
64
from pandas .core import nanops , ops
65
65
from pandas .core .algorithms import checked_add_with_arr , isin , unique1d , value_counts
66
66
from pandas .core .arraylike import OpsMixin
67
- from pandas .core .arrays ._mixins import NDArrayBackedExtensionArray
67
+ from pandas .core .arrays ._mixins import NDArrayBackedExtensionArray , ravel_compat
68
68
import pandas .core .common as com
69
69
from pandas .core .construction import array , extract_array
70
70
from pandas .core .indexers import check_array_indexer , check_setitem_lengths
@@ -679,6 +679,9 @@ def value_counts(self, dropna: bool = False):
679
679
-------
680
680
Series
681
681
"""
682
+ if self .ndim != 1 :
683
+ raise NotImplementedError
684
+
682
685
from pandas import Index , Series
683
686
684
687
if dropna :
@@ -694,6 +697,7 @@ def value_counts(self, dropna: bool = False):
694
697
)
695
698
return Series (result ._values , index = index , name = result .name )
696
699
700
+ @ravel_compat
697
701
def map (self , mapper ):
698
702
# TODO(GH-23179): Add ExtensionArray.map
699
703
# Need to figure out if we want ExtensionArray.map first.
@@ -820,6 +824,9 @@ def freq(self, value):
820
824
value = to_offset (value )
821
825
self ._validate_frequency (self , value )
822
826
827
+ if self .ndim > 1 :
828
+ raise ValueError ("Cannot set freq with ndim > 1" )
829
+
823
830
self ._freq = value
824
831
825
832
@property
@@ -918,7 +925,7 @@ def _is_monotonic_decreasing(self) -> bool:
918
925
919
926
@property
920
927
def _is_unique (self ) -> bool :
921
- return len (unique1d (self .asi8 )) == len ( self )
928
+ return len (unique1d (self .asi8 . ravel ( "K" ))) == self . size
922
929
923
930
# ------------------------------------------------------------------
924
931
# Arithmetic Methods
0 commit comments