Skip to content

Deprecate is_extension_type #19041

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

Closed
TomAugspurger opened this issue Jan 2, 2018 · 3 comments
Closed

Deprecate is_extension_type #19041

TomAugspurger opened this issue Jan 2, 2018 · 3 comments
Labels
Dtype Conversions Unexpected or buggy dtype conversions Internals Related to non-user accessible pandas implementation Interval Interval data type Period Period data type

Comments

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Jan 2, 2018

In favor of is_extension_array_type. This is blocked till sparse, period, and datetimetz are all EAs.


This should probably be True

In [3]: pd.api.types.is_extension_type(pd.interval_range(0, 10))
Out[3]: False

Likewise for Period?

In [3]: pd.api.types.is_extension_type(pd.period_range(2017, periods=2))
Out[3]: False

Currently we hardcode checks for categorical, sparse, and datetime w/ tz. A general solution would be to have all our extension types inherit from some base class or satisfy the interface required for an extension type.

xref #18767

@TomAugspurger TomAugspurger added Difficulty Intermediate Dtype Conversions Unexpected or buggy dtype conversions Internals Related to non-user accessible pandas implementation Interval Interval data type Period Period data type labels Jan 2, 2018
@TomAugspurger TomAugspurger added this to the Next Major Release milestone Jan 2, 2018
@toobaz
Copy link
Member

toobaz commented Aug 14, 2018

If i understand correctly, @TomAugspurger you are (in today's terms) just suggesting that is_extension_type should return True if is_extension_array_dtype does, right? (Notice this is already true for Categorical).

Then I think the only two hardcoded types would be datetimetz and sparse.

By the way: is there any plan to make those extension types too? The fact that

In [2]: s = pd.date_range(start='2010-08-08', end='2010-08-09', tz='utc')

In [3]: s._values is s
Out[3]: True

is quite annoying in parts of the code like this:

values = self._values

which assume that the _values of an Index are not an Index themselves.

@TomAugspurger
Copy link
Contributor Author

I think eventually we'll just remove is_extension_type, in favor of is_extension_array_dtype.

For context, changing everything in one go was too difficult, so we've kept is_extension_type for backwards compat. Once everything is an EA, we could remove it (after deprecating).

By the way: is there any plan to make those extension types too? The fact that

(just replied on the mailing list). I just opened a PR for sparse.

@TomAugspurger TomAugspurger changed the title is_extension_type on IntervalIndex, PeriodIndex is False Deprecate is_extension_type Aug 14, 2018
@jbrockmendel
Copy link
Member

closed by #29457

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Internals Related to non-user accessible pandas implementation Interval Interval data type Period Period data type
Projects
None yet
Development

No branches or pull requests

3 participants