-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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
REF: Deduplicate to_xml code #45132
Conversation
There was a problem hiding this 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
There was a problem hiding this 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.
pandas/io/formats/xml.py
Outdated
try: | ||
val = None if isna(d[col]) else str(d[col]) | ||
if val is not None: | ||
elem_row.attrib[attr_name] = val |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be copied?
There was a problem hiding this comment.
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])
There was a problem hiding this comment.
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
LGTM! Thanks, @phofl. Be sure to rebase. |
This also fixes some typing bugs detected after removing the init implementation