Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEPR: deprecate publicfacing .asobject #18477

Closed
wants to merge 1 commit into from

Conversation

topper-123
Copy link
Contributor

@topper-123 topper-123 commented Nov 24, 2017

  • [ x] xref DEPR: let's deprecate #18262
  • [x ] tests added / passedPR
  • [ x] passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • [ x] whatsnew entry

Deprecate Series.asobject and DateTimeIndex.asobject as public-facing attributes and make them private as per discussion in #18262.

@manrajgrover please note that I've made a PR on .asobject.

@topper-123 topper-123 force-pushed the depr_asobject branch 2 times, most recently from b45b26e to ace636e Compare November 24, 2017 23:27
@topper-123 topper-123 changed the title DEPR: deprecate public .asobject DEPR: deprecate publicfacing .asobject Nov 25, 2017
@topper-123 topper-123 force-pushed the depr_asobject branch 2 times, most recently from 37f0db6 to e693c60 Compare November 25, 2017 11:21
@codecov
Copy link

codecov bot commented Nov 25, 2017

Codecov Report

Merging #18477 into master will decrease coverage by 0.01%.
The diff coverage is 93.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18477      +/-   ##
==========================================
- Coverage   91.34%   91.32%   -0.02%     
==========================================
  Files         163      163              
  Lines       49717    49723       +6     
==========================================
- Hits        45413    45410       -3     
- Misses       4304     4313       +9
Flag Coverage Δ
#multiple 89.12% <93.93%> (ø) ⬆️
#single 40.51% <33.33%> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/core/ops.py 91.77% <ø> (ø) ⬆️
pandas/plotting/_converter.py 65.25% <0%> (ø) ⬆️
pandas/io/formats/format.py 96.01% <100%> (ø) ⬆️
pandas/core/indexing.py 92.8% <100%> (ø) ⬆️
pandas/core/indexes/datetimelike.py 97.13% <100%> (+0.01%) ⬆️
pandas/core/algorithms.py 94.14% <100%> (ø) ⬆️
pandas/core/dtypes/concat.py 99.13% <100%> (ø) ⬆️
pandas/core/indexes/timedeltas.py 91.17% <100%> (ø) ⬆️
pandas/core/internals.py 94.47% <100%> (ø) ⬆️
pandas/core/frame.py 97.8% <100%> (-0.1%) ⬇️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 412988e...b2f1438. Read the comment docs.

@codecov
Copy link

codecov bot commented Nov 25, 2017

Codecov Report

Merging #18477 into master will decrease coverage by 0.01%.
The diff coverage is 93.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18477      +/-   ##
==========================================
- Coverage   91.34%   91.32%   -0.02%     
==========================================
  Files         163      163              
  Lines       49717    49723       +6     
==========================================
- Hits        45413    45410       -3     
- Misses       4304     4313       +9
Flag Coverage Δ
#multiple 89.12% <93.93%> (ø) ⬆️
#single 40.51% <33.33%> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/core/ops.py 91.77% <ø> (ø) ⬆️
pandas/plotting/_converter.py 65.25% <0%> (ø) ⬆️
pandas/io/formats/format.py 96.01% <100%> (ø) ⬆️
pandas/core/indexes/timedeltas.py 91.17% <100%> (ø) ⬆️
pandas/core/indexes/datetimelike.py 97.13% <100%> (+0.01%) ⬆️
pandas/core/indexing.py 92.8% <100%> (ø) ⬆️
pandas/core/indexes/datetimes.py 95.49% <100%> (ø) ⬆️
pandas/core/dtypes/concat.py 99.13% <100%> (ø) ⬆️
pandas/core/indexes/period.py 92.94% <100%> (ø) ⬆️
pandas/core/internals.py 94.47% <100%> (ø) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 412988e...b2f1438. Read the comment docs.

@codecov
Copy link

codecov bot commented Nov 25, 2017

Codecov Report

Merging #18477 into master will decrease coverage by 0.01%.
The diff coverage is 93.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18477      +/-   ##
==========================================
- Coverage   91.34%   91.32%   -0.02%     
==========================================
  Files         163      163              
  Lines       49717    49723       +6     
==========================================
- Hits        45413    45410       -3     
- Misses       4304     4313       +9
Flag Coverage Δ
#multiple 89.12% <93.93%> (ø) ⬆️
#single 40.51% <33.33%> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/core/ops.py 91.77% <ø> (ø) ⬆️
pandas/plotting/_converter.py 65.25% <0%> (ø) ⬆️
pandas/core/frame.py 97.8% <100%> (-0.1%) ⬇️
pandas/core/indexes/timedeltas.py 91.17% <100%> (ø) ⬆️
pandas/core/indexes/datetimes.py 95.49% <100%> (ø) ⬆️
pandas/core/indexes/datetimelike.py 97.13% <100%> (+0.01%) ⬆️
pandas/core/indexing.py 92.8% <100%> (ø) ⬆️
pandas/core/dtypes/concat.py 99.13% <100%> (ø) ⬆️
pandas/core/algorithms.py 94.14% <100%> (ø) ⬆️
pandas/core/internals.py 94.47% <100%> (ø) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 412988e...b2f1438. Read the comment docs.

@jreback jreback added the Deprecate Functionality to remove in pandas label Nov 25, 2017
@jreback jreback mentioned this pull request Nov 25, 2017
34 tasks
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't create ._asobject this just creates technical debt for later, simply change to .astype(object) which already handles this case

@@ -84,7 +84,7 @@ Deprecations
~~~~~~~~~~~~

- ``Series.from_array`` and ``SparseSeries.from_array`` are deprecated. Use the normal constructor ``Series(..)`` and ``SparseSeries(..)`` instead (:issue:`18213`).
-
- ``Series.asobject``, ``DatetimeIndex.asobject`` and ``PeriodIndex.asobject``have been deprecated. Use '.astype(object).values' instead (:issue:`18477`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its just .astype(object)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It you follow the call chain down it translates to ser._data.blocks[0].values.astype(object). So I'd say it should be "use .values.astype(object)", which is an ndarray, while .astype(object) returns a Series.

I'll use the form.values.astype(object), unless you comment

@@ -369,7 +369,7 @@ def unique(values):
# to return an object array of tz-aware Timestamps

# TODO: it must return DatetimeArray with tz in pandas 2.0
uniques = uniques.asobject.values
uniques = uniques._asobject.values
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change usage to .astype(object)

"""
warnings.warn("'.asobject' is deprecated. Use 'astype(object).values'"
" instead", FutureWarning, stacklevel=2)
return self._asobject
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return self.astype(object)

"""
return object Index which contains boxed values

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this entirely

@topper-123
Copy link
Contributor Author

So, everywhere change _asobject to astype(object)? Ok.