Skip to content

Conversation

suzyahyah
Copy link
Contributor

@suzyahyah suzyahyah commented Oct 10, 2025

This PR handles all the cases of inconsistent datetime to_numeric handling from Issue 42380

The changes in pandas/_libs/lib.pyx, is the core logic for datetime handling, and is a singular place which handles scalar values, pd.Series and Series(input_value).apply(partial(to_numeric))

The removal of elif lib.is_np_dtype(values_dtype, "mM"): values = values.view(np.int64) in pandas/core/tools/numeric.py, addresses the bug where int value of NaT are returned.

@suzyahyah suzyahyah marked this pull request as draft October 10, 2025 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: pd.to_numeric has an inconsistent behavior for datetime objects
1 participant