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: Index.to_native_types #36418

Merged

Conversation

jorisvandenbossche
Copy link
Member

Closes #28867

@jorisvandenbossche jorisvandenbossche added the Deprecate Functionality to remove in pandas label Sep 17, 2020
@jorisvandenbossche jorisvandenbossche mentioned this pull request Sep 17, 2020
34 tasks
@jbrockmendel
Copy link
Member

LGTM

@@ -212,6 +212,7 @@ Deprecations
- Deprecated parameter ``dtype`` in :~meth:`Index.copy` on method all index classes. Use the :meth:`Index.astype` method instead for changing dtype(:issue:`35853`)
- Date parser functions :func:`~pandas.io.date_converters.parse_date_time`, :func:`~pandas.io.date_converters.parse_date_fields`, :func:`~pandas.io.date_converters.parse_all_fields` and :func:`~pandas.io.date_converters.generic_parser` from ``pandas.io.date_converters`` are deprecated and will be removed in a future version; use :func:`to_datetime` instead (:issue:`35741`)
- :meth:`DataFrame.lookup` is deprecated and will be removed in a future version, use :meth:`DataFrame.melt` and :meth:`DataFrame.loc` instead (:issue:`18682`)
- The :meth:`Index.to_native_types` is deprecated. Use ``.astype(str)`` instead (:issue:`28867`)
Copy link
Member

Choose a reason for hiding this comment

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

looking at the docstring for to_native_types, .astype(str) does not cover all the options.

@jorisvandenbossche if I am correct, what the to_native_types method does is add some extra formatting options? These could in principle be useful for users as well? #23820 (comment) 😉

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah this is almost entirely internal.

Copy link
Member Author

Choose a reason for hiding this comment

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

Those can indeed be potentially useful, but some of them are exposed through display options already, if you want to control how your dataframe is formatted.

Further, I think the main thing is that we simply don't want to have this method in this form public ;) And I mainly wanted to give some alternative (for the default arguments), can also leave it out if will only confuse.
There has been discussion about a generic format() method (#17211)

Copy link
Member

Choose a reason for hiding this comment

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

yeah this is almost entirely internal.

API documented https://pandas.pydata.org/pandas-docs/dev/reference/api/pandas.Index.to_native_types.html

And I mainly wanted to give some alternative (for the default arguments), can also leave it out if will only confuse.

since public, I think the release note should stay.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I only meant to remove the " Use .astype(str) instead " part. We regularly have methods that are deprecated without direct alternative if we don't think it is worth mentioning.

@jreback jreback added this to the 1.2 milestone Sep 17, 2020
@jreback jreback added the Index Related to the Index class or subclasses label Sep 17, 2020
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.

lgtm. some test failures?

@jorisvandenbossche
Copy link
Member Author

lgtm. some test failures?

Environment build issues on Travis, also happening on master

@jreback jreback merged commit 3e1cc56 into pandas-dev:master Sep 19, 2020
@jreback
Copy link
Contributor

jreback commented Sep 19, 2020

thanks @jorisvandenbossche

@jorisvandenbossche jorisvandenbossche deleted the depr-index-to-native-types branch September 19, 2020 07:38
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Index Related to the Index class or subclasses
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DEPR: deprecate Index.to_native_types() ?
4 participants