Skip to content

ENH: add dtype to read_xml #45341

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
MehdiALLALA opened this issue Jan 13, 2022 · 2 comments
Closed

ENH: add dtype to read_xml #45341

MehdiALLALA opened this issue Jan 13, 2022 · 2 comments
Labels
Dtype Conversions Unexpected or buggy dtype conversions Enhancement IO XML read_xml, to_xml

Comments

@MehdiALLALA
Copy link

MehdiALLALA commented Jan 13, 2022

Is your feature request related to a problem?

pandas column type detection is not precise. for some columns the type in not the actual data type when reading xml files with read_xml.

Describe the solution you'd like

the solution is to add dtype option in the read_xml utility that will provide pandas with the wanted column types, this feature exists already with read_json, read_csv and many other utilities.

API breaking implications

this will make the read_xml utility detect the right type for each column. to keep the data in the correct format.

Describe alternatives you've considered

creating a script that will use the default pandas.DataFrame(......) constructor that contains dtype option to parse the xml file.
Capture6
Capture7

the loaded result from the read_xml is not the same as the xml file. the highlighted column is a string but pandas read it as an integer and with this the data is corrupted.

@MehdiALLALA MehdiALLALA added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 13, 2022
@mroeschke mroeschke added Dtype Conversions Unexpected or buggy dtype conversions IO XML read_xml, to_xml and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 14, 2022
@ParfaitG
Copy link
Contributor

Thanks, @MehdiALLALA. The dtypes feature for read_xml was raised in a similar issue, #43567, and added to issue tracker, #40131.

@mroeschke
Copy link
Member

Closing as a duplicate of #43567

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 Enhancement IO XML read_xml, to_xml
Projects
None yet
Development

No branches or pull requests

3 participants