Skip to content

Commit 6e7894a

Browse files
author
tp
committed
change deprecation of .asobject according to comments
1 parent 4cb8776 commit 6e7894a

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

doc/source/whatsnew/v0.22.0.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ Deprecations
8989

9090
- ``Series.from_array`` and ``SparseSeries.from_array`` are deprecated. Use the normal constructor ``Series(..)`` and ``SparseSeries(..)`` instead (:issue:`18213`).
9191
- ``DataFrame.as_matrix`` is deprecated. Use ``DataFrame.values`` instead (:issue:`18458`).
92-
- ``DatetimeIndex.asobject``, ``PeriodIndex.asobject`` and ``TimeDeltaIndex.asobject`` have been deprecated. Use '.astype(object)' instead (:issue:`18572`)
93-
- ``Series.asobject`` has been deprecated. Use '.astype(object).values' instead (:issue:`18572`)
92+
- ``Series.asobject``, ``DatetimeIndex.asobject``, ``PeriodIndex.asobject`` and ``TimeDeltaIndex.asobject`` have been deprecated. Use '.astype(object)' instead (:issue:`18572`)
9493

9594
.. _whatsnew_0220.prior_deprecations:
9695

pandas/core/series.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,13 @@ def get_values(self):
420420

421421
@property
422422
def asobject(self):
423-
"""DEPRECATED: Use ``astype(object).values`` instead.
423+
"""DEPRECATED: Use ``astype(object)`` instead.
424424
425425
return object Series which contains boxed values
426426
427427
*this is an internal non-public method*
428428
"""
429-
warnings.warn("'asobject' is deprecated. Use 'astype(object).values'"
429+
warnings.warn("'asobject' is deprecated. Use 'astype(object)'"
430430
" instead", FutureWarning, stacklevel=2)
431431
return self.astype(object).values
432432

pandas/tests/indexes/datetimes/test_ops.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_ops_properties_basic(self):
5151
assert s.day == 10
5252
pytest.raises(AttributeError, lambda: s.weekday)
5353

54-
def test_astype(self):
54+
def test_astype_object(self):
5555
idx = pd.date_range(start='2013-01-01', periods=4, freq='M',
5656
name='idx')
5757
expected_list = [Timestamp('2013-01-31'),

0 commit comments

Comments
 (0)