@@ -500,8 +500,7 @@ def _from_sequence(cls, scalars, dtype=None, copy=False):
500
500
def copy (self ):
501
501
""" Copy constructor. """
502
502
return self ._constructor (values = self ._codes .copy (),
503
- categories = self .categories ,
504
- ordered = self .ordered ,
503
+ dtype = self .dtype ,
505
504
fastpath = True )
506
505
507
506
def astype (self , dtype , copy = True ):
@@ -1632,8 +1631,8 @@ def sort_values(self, inplace=False, ascending=True, na_position='last'):
1632
1631
self ._codes = codes
1633
1632
return
1634
1633
else :
1635
- return self ._constructor (values = codes , categories = self .categories ,
1636
- ordered = self . ordered , fastpath = True )
1634
+ return self ._constructor (values = codes , dtype = self .dtype ,
1635
+ fastpath = True )
1637
1636
1638
1637
def _values_for_rank (self ):
1639
1638
"""
@@ -1777,8 +1776,7 @@ def fillna(self, value=None, method=None, limit=None):
1777
1776
'or Series, but you passed a '
1778
1777
'"{0}"' .format (type (value ).__name__ ))
1779
1778
1780
- return self ._constructor (values , categories = self .categories ,
1781
- ordered = self .ordered , fastpath = True )
1779
+ return self ._constructor (values , dtype = self .dtype , fastpath = True )
1782
1780
1783
1781
def take_nd (self , indexer , allow_fill = None , fill_value = None ):
1784
1782
"""
@@ -1823,8 +1821,7 @@ def take_nd(self, indexer, allow_fill=None, fill_value=None):
1823
1821
1824
1822
codes = take (self ._codes , indexer , allow_fill = allow_fill ,
1825
1823
fill_value = fill_value )
1826
- result = self ._constructor (codes , categories = self .categories ,
1827
- ordered = self .ordered , fastpath = True )
1824
+ result = self ._constructor (codes , dtype = self .dtype , fastpath = True )
1828
1825
return result
1829
1826
1830
1827
take = take_nd
@@ -1843,9 +1840,8 @@ def _slice(self, slicer):
1843
1840
"categorical" )
1844
1841
slicer = slicer [1 ]
1845
1842
1846
- _codes = self ._codes [slicer ]
1847
- return self ._constructor (values = _codes , categories = self .categories ,
1848
- ordered = self .ordered , fastpath = True )
1843
+ codes = self ._codes [slicer ]
1844
+ return self ._constructor (values = codes , dtype = self .dtype , fastpath = True )
1849
1845
1850
1846
def __len__ (self ):
1851
1847
"""The length of this Categorical."""
@@ -2157,8 +2153,8 @@ def mode(self, dropna=True):
2157
2153
good = self ._codes != - 1
2158
2154
values = self ._codes [good ]
2159
2155
values = sorted (htable .mode_int64 (ensure_int64 (values ), dropna ))
2160
- result = self ._constructor (values = values , categories = self .categories ,
2161
- ordered = self . ordered , fastpath = True )
2156
+ result = self ._constructor (values = values , dtype = self .dtype ,
2157
+ fastpath = True )
2162
2158
return result
2163
2159
2164
2160
def unique (self ):
@@ -2298,8 +2294,7 @@ def repeat(self, repeats, *args, **kwargs):
2298
2294
"""
2299
2295
nv .validate_repeat (args , kwargs )
2300
2296
codes = self ._codes .repeat (repeats )
2301
- return self ._constructor (values = codes , categories = self .categories ,
2302
- ordered = self .ordered , fastpath = True )
2297
+ return self ._constructor (values = codes , dtype = self .dtype , fastpath = True )
2303
2298
2304
2299
# Implement the ExtensionArray interface
2305
2300
@property
0 commit comments