diff --git a/pandas/core/arrays/datetimelike.py b/pandas/core/arrays/datetimelike.py index 50fecc96f8186..d5e654c95577e 100644 --- a/pandas/core/arrays/datetimelike.py +++ b/pandas/core/arrays/datetimelike.py @@ -1778,7 +1778,7 @@ def strftime(self, date_format: str) -> npt.NDArray[np.object_]: >>> rng.strftime("%%B %%d, %%Y, %%r") Index(['March 10, 2018, 09:00:00 AM', 'March 10, 2018, 09:00:01 AM', 'March 10, 2018, 09:00:02 AM'], - dtype='object') + dtype='str') """ result = self._format_native_types(date_format=date_format, na_rep=np.nan) if using_string_dtype(): diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index b31c543188282..57c138d9828bd 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -1308,14 +1308,14 @@ def month_name(self, locale=None) -> npt.NDArray[np.object_]: 0 January 1 February 2 March - dtype: object + dtype: str >>> idx = pd.date_range(start="2018-01", freq="ME", periods=3) >>> idx DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31'], dtype='datetime64[ns]', freq='ME') >>> idx.month_name() - Index(['January', 'February', 'March'], dtype='object') + Index(['January', 'February', 'March'], dtype='str') Using the ``locale`` parameter you can set a different locale language, for example: ``idx.month_name(locale='pt_BR.utf8')`` will return month @@ -1326,7 +1326,7 @@ def month_name(self, locale=None) -> npt.NDArray[np.object_]: DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31'], dtype='datetime64[ns]', freq='ME') >>> idx.month_name(locale="pt_BR.utf8") # doctest: +SKIP - Index(['Janeiro', 'Fevereiro', 'Março'], dtype='object') + Index(['Janeiro', 'Fevereiro', 'Março'], dtype='str') """ values = self._local_timestamps() @@ -1376,14 +1376,14 @@ def day_name(self, locale=None) -> npt.NDArray[np.object_]: 0 Monday 1 Tuesday 2 Wednesday - dtype: object + dtype: str >>> idx = pd.date_range(start="2018-01-01", freq="D", periods=3) >>> idx DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03'], dtype='datetime64[ns]', freq='D') >>> idx.day_name() - Index(['Monday', 'Tuesday', 'Wednesday'], dtype='object') + Index(['Monday', 'Tuesday', 'Wednesday'], dtype='str') Using the ``locale`` parameter you can set a different locale language, for example: ``idx.day_name(locale='pt_BR.utf8')`` will return day @@ -1394,7 +1394,7 @@ def day_name(self, locale=None) -> npt.NDArray[np.object_]: DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03'], dtype='datetime64[ns]', freq='D') >>> idx.day_name(locale="pt_BR.utf8") # doctest: +SKIP - Index(['Segunda', 'Terça', 'Quarta'], dtype='object') + Index(['Segunda', 'Terça', 'Quarta'], dtype='str') """ values = self._local_timestamps() diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 3efd601545212..e8c5a03a6de50 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -1209,7 +1209,7 @@ def astype(self, dtype: Dtype, copy: bool = True): -------- >>> idx = pd.Index(['a', 'b', 'c']) >>> idx.take([2, 2, 1, 2]) - Index(['c', 'c', 'b', 'c'], dtype='object') + Index(['c', 'c', 'b', 'c'], dtype='str') """ @Appender(_index_shared_docs["take"] % _index_doc_kwargs) @@ -6862,11 +6862,11 @@ def delete( -------- >>> idx = pd.Index(["a", "b", "c"]) >>> idx.delete(1) - Index(['a', 'c'], dtype='object') + Index(['a', 'c'], dtype='str') >>> idx = pd.Index(["a", "b", "c"]) >>> idx.delete([0, 2]) - Index(['b'], dtype='object') + Index(['b'], dtype='str') """ values = self._values res_values: ArrayLike @@ -6906,7 +6906,7 @@ def insert(self, loc: int, item) -> Index: -------- >>> idx = pd.Index(["a", "b", "c"]) >>> idx.insert(1, "x") - Index(['a', 'x', 'b', 'c'], dtype='object') + Index(['a', 'x', 'b', 'c'], dtype='str') """ item = lib.item_from_zerodim(item) if is_valid_na_for_dtype(item, self.dtype) and self.dtype != object: