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

API: pd.array convert unsupported dt64/td64 to supported? #53058

Closed
jbrockmendel opened this issue May 3, 2023 · 3 comments · Fixed by #53817
Closed

API: pd.array convert unsupported dt64/td64 to supported? #53058

jbrockmendel opened this issue May 3, 2023 · 3 comments · Fixed by #53817
Assignees
Labels
API - Consistency Internal Consistency of API/Behavior Constructors Series/DataFrame/Index/pd.array Constructors Deprecate Functionality to remove in pandas

Comments

@jbrockmendel
Copy link
Member

jbrockmendel commented May 3, 2023

dtype = np.dtype("M8[h]")
arr = pd.array([], dtype=dtype)

>>> arr
<PandasArray>
[]
Length: 0, dtype: datetime64[h]

In most cases we'd like to align behavior across different constructors (pd.Series, pd.Index, pd.array). One case where we currently don't do that is with an un-supported numpy dt64/td64 dtype. pd.Series/pd.Index will raise on this, while pd.array will wrap it in a PandasArray.

I propose we deprecate that behavior and raise in pd.array like we would in Series/Index.

xref #27460

@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels May 3, 2023
@lithomas1 lithomas1 added Constructors Series/DataFrame/Index/pd.array Constructors API - Consistency Internal Consistency of API/Behavior Deprecate Functionality to remove in pandas and removed Needs Triage Issue that has not been reviewed by a pandas team member Bug labels May 3, 2023
@rmhowe425
Copy link
Contributor

@jbrockmendel @lithomas1 I can work this one.

Do we want to raise a warning to deprecate the current behavior before we raise an error?

@rmhowe425
Copy link
Contributor

take

@jbrockmendel
Copy link
Member Author

Will need to be a deprecation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Constructors Series/DataFrame/Index/pd.array Constructors Deprecate Functionality to remove in pandas
Projects
None yet
3 participants