-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
Conversation
b45b26e
to
ace636e
Compare
37f0db6
to
e693c60
Compare
e693c60
to
b2f1438
Compare
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
There was a problem hiding this 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`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its just .astype(object)
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this entirely
So, everywhere change _asobject to astype(object)? Ok. |
yep |
can you rebase |
git diff upstream/master -u -- "*.py" | flake8 --diff
Deprecate
Series.asobject
andDateTimeIndex.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
.