Last active
May 10, 2024 08:41
-
-
Save JoaoCarabetta/fcc2ce166fea58b0397e7b1f77b96f34 to your computer and use it in GitHub Desktop.
Three lines to convert xml to csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xmltodict | |
import pandas as pd | |
import requests | |
xml = request.get('url').text | |
df = pd.DataFrame(xmltodict.parse(xml)) | |
df.rename(columns=lambda x: x.replace('@', ''), inplace=True) | |
df.to_csv('data.csv') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment