Skip to content

Instantly share code, notes, and snippets.

@JoaoCarabetta
Last active July 10, 2021 10:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JoaoCarabetta/fcc2ce166fea58b0397e7b1f77b96f34 to your computer and use it in GitHub Desktop.
Save JoaoCarabetta/fcc2ce166fea58b0397e7b1f77b96f34 to your computer and use it in GitHub Desktop.
Three lines to convert xml to csv
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