Skip to content

REF: Deduplicate to_xml code #45132

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

Merged
merged 8 commits into from
Jan 1, 2022
Merged

REF: Deduplicate to_xml code #45132

merged 8 commits into from
Jan 1, 2022

Conversation

phofl
Copy link
Member

@phofl phofl commented Dec 30, 2021

  • Ensure all linting tests pass, see here for how to run them

This also fixes some typing bugs detected after removing the init implementation

@phofl phofl added the IO XML read_xml, to_xml label Dec 30, 2021
@jreback jreback added this to the 1.4 milestone Dec 30, 2021
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

@ParfaitG if you can have a look

@jreback jreback added the Refactor Internal refactoring of code label Dec 30, 2021
Copy link
Contributor

@ParfaitG ParfaitG left a comment

Choose a reason for hiding this comment

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

Thanks @phofl with refactoring this code! I just have a few comments in my walk-through.

try:
val = None if isna(d[col]) else str(d[col])
if val is not None:
elem_row.attrib[attr_name] = val
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be copied?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe avoid val? (This change came on last recent to_xml PR).

if not isna(d[col]):
    elem_row.attrib[attr_name] = str(d[col])

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep thx, this sounds good

@ParfaitG
Copy link
Contributor

ParfaitG commented Jan 1, 2022

LGTM! Thanks, @phofl. Be sure to rebase.

@jreback jreback merged commit 9dfb454 into pandas-dev:master Jan 1, 2022
@jreback
Copy link
Contributor

jreback commented Jan 1, 2022

thanks @phofl and @ParfaitG for reviewing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO XML read_xml, to_xml Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants