Skip to content

API: Clean up dtypes/common.py #16242

Closed
Closed
@gfyoung

Description

@gfyoung

When I was developing #16237, I noticed that the API for checking dtype is quite messy. We appear to have duplicate functionality, and the interface is not clear as to what we should accept.

I propose that for all such dtype checking functions, we should accept ANY array-like and ANY dtype OR type object and cast any list-like object to np.array.

Also, I added several TODO in that same file that I was hoping to get some feedback on. They stood out to me because they seemed either non-intuitive OR symptomatic of the API redundancy that I was referring to.

  • is_datetimetz seems like a duplicate of is_datetime64tz_dtype. Do we need it?
  • is_period seems like a duplicate of is_period_arraylike. Do we need it?
  • Should Period be an instance of PeriodDtype?
  • Should Interval be an instance of IntervalDtype?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions