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

BUG: read_json not handling string dtype when converting to dates #56195

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

phofl
Copy link
Member

@phofl phofl commented Nov 26, 2023

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@@ -1301,6 +1304,10 @@ def _try_convert_to_date(self, data):
return data, False

new_data = data

if new_data.dtype == "string":
Copy link
Member

Choose a reason for hiding this comment

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

Should this include ArrowDtype[string]?

Copy link
Member Author

@phofl phofl Nov 27, 2023

Choose a reason for hiding this comment

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

No that shouldn't be necessary, you can't end up with arrow strings in columns that could be dates, that can only happen with the automatic conversion when the infer string option is set

@mroeschke mroeschke added IO JSON read_json, to_json, json_normalize Strings String extension data type and string data labels Nov 27, 2023
@mroeschke mroeschke added this to the 2.2 milestone Nov 27, 2023
@mroeschke mroeschke merged commit f6eee83 into pandas-dev:main Nov 27, 2023
46 checks passed
@mroeschke
Copy link
Member

Thanks @phofl

@phofl phofl deleted the json_convert_data branch November 27, 2023 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO JSON read_json, to_json, json_normalize Strings String extension data type and string data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants