Skip to content

Commit aca4e66

Browse files
committed
update Appender to doc in category.py
1 parent ae7f442 commit aca4e66

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

pandas/core/indexes/category.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pandas._libs.hashtable import duplicated_int64
1010
from pandas._libs.lib import no_default
1111
from pandas._typing import Label
12-
from pandas.util._decorators import Appender, cache_readonly
12+
from pandas.util._decorators import Appender, cache_readonly, doc
1313

1414
from pandas.core.dtypes.common import (
1515
ensure_platform_int,
@@ -241,7 +241,7 @@ def _simple_new(cls, values: Categorical, name: Label = None):
241241

242242
# --------------------------------------------------------------------
243243

244-
@Appender(Index._shallow_copy.__doc__)
244+
@doc(Index._shallow_copy)
245245
def _shallow_copy(self, values=None, name: Label = no_default):
246246
if values is not None:
247247
values = Categorical(values, dtype=self.dtype)
@@ -351,7 +351,7 @@ def _has_complex_internals(self) -> bool:
351351
# used to avoid libreduction code paths, which raise or require conversion
352352
return True
353353

354-
@Appender(Index.__contains__.__doc__)
354+
@doc(Index.__contains__)
355355
def __contains__(self, key: Any) -> bool:
356356
# if key is a NaN, check if any NaN is in self.
357357
if is_scalar(key) and isna(key):
@@ -360,7 +360,7 @@ def __contains__(self, key: Any) -> bool:
360360
hash(key)
361361
return contains(self, key, container=self._engine)
362362

363-
@Appender(Index.astype.__doc__)
363+
@doc(Index.astype)
364364
def astype(self, dtype, copy=True):
365365
if is_interval_dtype(dtype):
366366
from pandas import IntervalIndex
@@ -379,7 +379,7 @@ def _isnan(self):
379379
""" return if each value is nan"""
380380
return self._data.codes == -1
381381

382-
@Appender(Index.fillna.__doc__)
382+
@doc(Index.fillna)
383383
def fillna(self, value, downcast=None):
384384
self._assert_can_do_op(value)
385385
return CategoricalIndex(self._data.fillna(value), name=self.name)
@@ -392,7 +392,7 @@ def _engine(self):
392392
codes = self.codes
393393
return self._engine_type(lambda: codes, len(self))
394394

395-
@Appender(Index.unique.__doc__)
395+
@doc(Index.unique)
396396
def unique(self, level=None):
397397
if level is not None:
398398
self._validate_index_level(level)
@@ -401,7 +401,7 @@ def unique(self, level=None):
401401
# of result, not self.
402402
return type(self)._simple_new(result, name=self.name)
403403

404-
@Appender(Index.duplicated.__doc__)
404+
@doc(Index.duplicated)
405405
def duplicated(self, keep="first"):
406406
codes = self.codes.astype("i8")
407407
return duplicated_int64(codes, keep)
@@ -415,7 +415,7 @@ def _maybe_cast_indexer(self, key):
415415
code = self.codes.dtype.type(code)
416416
return code
417417

418-
@Appender(Index.where.__doc__)
418+
@doc(Index.where)
419419
def where(self, cond, other=None):
420420
# TODO: Investigate an alternative implementation with
421421
# 1. copy the underlying Categorical
@@ -566,7 +566,7 @@ def get_indexer_non_unique(self, target):
566566
indexer, missing = self._engine.get_indexer_non_unique(codes)
567567
return ensure_platform_int(indexer), missing
568568

569-
@Appender(Index._convert_list_indexer.__doc__)
569+
@doc(Index._convert_list_indexer)
570570
def _convert_list_indexer(self, keyarr):
571571
# Return our indexer or raise if all of the values are not included in
572572
# the categories
@@ -583,7 +583,7 @@ def _convert_list_indexer(self, keyarr):
583583

584584
return self.get_indexer(keyarr)
585585

586-
@Appender(Index._convert_arr_indexer.__doc__)
586+
@doc(Index._convert_arr_indexer)
587587
def _convert_arr_indexer(self, keyarr):
588588
keyarr = com.asarray_tuplesafe(keyarr)
589589

@@ -592,7 +592,7 @@ def _convert_arr_indexer(self, keyarr):
592592

593593
return self._shallow_copy(keyarr)
594594

595-
@Appender(Index._convert_index_indexer.__doc__)
595+
@doc(Index._convert_index_indexer)
596596
def _convert_index_indexer(self, keyarr):
597597
return self._shallow_copy(keyarr)
598598

@@ -605,7 +605,7 @@ def take_nd(self, *args, **kwargs):
605605
)
606606
return self.take(*args, **kwargs)
607607

608-
@Appender(Index._maybe_cast_slice_bound.__doc__)
608+
@doc(Index._maybe_cast_slice_bound)
609609
def _maybe_cast_slice_bound(self, label, side, kind):
610610
if kind == "loc":
611611
return label

0 commit comments

Comments
 (0)