Updated June 10th, 2017: Special thanks to all the contributors in the comments section!
Convert any XML file into a pandas dataframe.
I found a lot of examples on the internet of how to convert XML into DataFrames, but each example was very tailored. Our version will take in any XML file and format the headers properly.
For this example, we’re going to convert a User Agent tracker XML feed
Before running the sure to download the xml file above.
It’s fairly straight forward, so I’ll comment each line to explain.
If all went well you should now have a DataFrame as seen below:
|0||id_a_f_3||!Susie (http://www.sync2it.com/susie)||Sync2It bookmark management & clustering engine||C R||None||http://www.sync2it.com||None|
|1||id_a_f_6||<a href='http://www.unchaos.com/'> UnChaos </a...||UnCHAOS search robot||R||Site is dead||http://www.unchaos.com/||None|
|2||id_a_f_7||<a href='http://www.unchaos.com/'> UnChaos Bot...||UnCHAOS search robot||R||Site is dead||http://www.unchaos.com/||None|
Thanks for reading!
If you found this helpful, please feel free to share and comment below.