title: Pandas read_xml() method test strategies
body: <p>Currently, <a href="http://pandas.pydata.org/pandas-docs/stable/io.html" rel="noreferrer">pandas I/O tools</a> does not maintain a <code>read_xml()</code> method and the counterpart <code>to_xml()</code>. However, <a href="https://github.com/pandas-dev/pandas/blob/master/pandas/io/json.py" rel="noreferrer"><code>read_json</code></a> proves tree-like structures can be implemented for dataframe import and <a href="https://github.com/pandas-dev/pandas/blob/master/pandas/io/html.py" rel="noreferrer"><code>read_html</code></a> for markup formats.</p>
  
  <p>If the pandas team does consider such a <code>read_xml</code> method for a future pandas version, what implementation would they pursue:  parsing with built-in <code>xml.etree.ElementTree</code> with its <code>iterfind()</code> or <code>iterparse()</code> functions or the third-party module, <code>lxml</code> with its XPath 1.0 and XSLT 1.0 methods? </p>
  
  <p>Below are my test runs for four method types on a simple, flat, element-centric XML input. All are set up for generalized parsing for any second level children of root and each method should yield exact same pandas dataframe. All but the last calls <code>pd.Dataframe()</code> on list of dictionaries. The XSLT method transforms XML to CSV for casted <code>StringIO()</code> in <code>pd.read_csv()</code>.</p>
  
  <p><strong>Question</strong> <em>(multi-part)</em></p>
  
  <ul>
  <li><p>PERFORMANCE: How do you explain the slower <code>iterparse</code> often recommended for larger files as file is iteratively parsed? Is it partly due to the <code>if</code> logic checks?</p></li>
  <li><p>MEMORY: Do CPU memory correlate with timings in I/O calls? XSLT and XPath 1.0 tend not to scale well with larger XML documents as entire file must be read in memory to be parsed.</p></li>
  <li><p>STRATEGY: Is list of dictionaries an optimal strategy for <code>Dataframe()</code> call? See these interesting answers: <a href="https://stackoverflow.com/questions/28259301/how-to-convert-an-xml-file-to-nice-pandas-dataframe">generator</a> version and a <a href="https://stackoverflow.com/questions/26077231/how-to-open-this-xml-file-to-create-dataframe-in-python">iterwalk user-defined</a> version. Both upcast lists to dataframe.</p></li>
  </ul>
  
  <p><strong>Input</strong> Data <em>(Stack Overflow's current <a href="https://stackoverflow.com/users?page=1&amp;tab=reputation&amp;filter=year">top users by year </a> of which our pandas friends are included)</em></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;stackoverflow&gt;
    &lt;topusers&gt;
      &lt;user&gt;Gordon Linoff&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/1144035/gordon-linoff&lt;/link&gt;
      &lt;location&gt;New York, United States&lt;/location&gt;
      &lt;year_rep&gt;5,985&lt;/year_rep&gt;
      &lt;total_rep&gt;499,408&lt;/total_rep&gt;
      &lt;tag1&gt;sql&lt;/tag1&gt;
      &lt;tag2&gt;sql-server&lt;/tag2&gt;
      &lt;tag3&gt;mysql&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Günter Zöchbauer&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/217408/g%c3%bcnter-z%c3%b6chbauer&lt;/link&gt;
      &lt;location&gt;Linz, Austria&lt;/location&gt;
      &lt;year_rep&gt;5,835&lt;/year_rep&gt;
      &lt;total_rep&gt;154,439&lt;/total_rep&gt;
      &lt;tag1&gt;angular2&lt;/tag1&gt;
      &lt;tag2&gt;typescript&lt;/tag2&gt;
      &lt;tag3&gt;javascript&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;jezrael&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/2901002/jezrael&lt;/link&gt;
      &lt;location&gt;Bratislava, Slovakia&lt;/location&gt;
      &lt;year_rep&gt;5,740&lt;/year_rep&gt;
      &lt;total_rep&gt;83,237&lt;/total_rep&gt;
      &lt;tag1&gt;pandas&lt;/tag1&gt;
      &lt;tag2&gt;python&lt;/tag2&gt;
      &lt;tag3&gt;dataframe&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;VonC&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/6309/vonc&lt;/link&gt;
      &lt;location&gt;France&lt;/location&gt;
      &lt;year_rep&gt;5,577&lt;/year_rep&gt;
      &lt;total_rep&gt;651,397&lt;/total_rep&gt;
      &lt;tag1&gt;git&lt;/tag1&gt;
      &lt;tag2&gt;github&lt;/tag2&gt;
      &lt;tag3&gt;docker&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Martijn Pieters&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/100297/martijn-pieters&lt;/link&gt;
      &lt;location&gt;Cambridge, United Kingdom&lt;/location&gt;
      &lt;year_rep&gt;5,337&lt;/year_rep&gt;
      &lt;total_rep&gt;525,176&lt;/total_rep&gt;
      &lt;tag1&gt;python&lt;/tag1&gt;
      &lt;tag2&gt;python-3.x&lt;/tag2&gt;
      &lt;tag3&gt;python-2.7&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;T.J. Crowder&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/157247/t-j-crowder&lt;/link&gt;
      &lt;location&gt;United Kingdom&lt;/location&gt;
      &lt;year_rep&gt;5,258&lt;/year_rep&gt;
      &lt;total_rep&gt;508,310&lt;/total_rep&gt;
      &lt;tag1&gt;javascript&lt;/tag1&gt;
      &lt;tag2&gt;jquery&lt;/tag2&gt;
      &lt;tag3&gt;java&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;akrun&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/3732271/akrun&lt;/link&gt;
      &lt;location&gt;&lt;/location&gt;
      &lt;year_rep&gt;5,188&lt;/year_rep&gt;
      &lt;total_rep&gt;229,553&lt;/total_rep&gt;
      &lt;tag1&gt;r&lt;/tag1&gt;
      &lt;tag2&gt;dplyr&lt;/tag2&gt;
      &lt;tag3&gt;dataframe&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Wiktor Stribi?ew&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/3832970/wiktor-stribi%c5%bcew&lt;/link&gt;
      &lt;location&gt;Warsaw, Poland&lt;/location&gt;
      &lt;year_rep&gt;4,948&lt;/year_rep&gt;
      &lt;total_rep&gt;158,134&lt;/total_rep&gt;
      &lt;tag1&gt;regex&lt;/tag1&gt;
      &lt;tag2&gt;javascript&lt;/tag2&gt;
      &lt;tag3&gt;c#&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Darin Dimitrov&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/29407/darin-dimitrov&lt;/link&gt;
      &lt;location&gt;Sofia, Bulgaria&lt;/location&gt;
      &lt;year_rep&gt;4,936&lt;/year_rep&gt;
      &lt;total_rep&gt;709,683&lt;/total_rep&gt;
      &lt;tag1&gt;c#&lt;/tag1&gt;
      &lt;tag2&gt;asp.net-mvc&lt;/tag2&gt;
      &lt;tag3&gt;asp.net-mvc-3&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Eric Duminil&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/6419007/eric-duminil&lt;/link&gt;
      &lt;location&gt;&lt;/location&gt;
      &lt;year_rep&gt;4,854&lt;/year_rep&gt;
      &lt;total_rep&gt;12,557&lt;/total_rep&gt;
      &lt;tag1&gt;ruby&lt;/tag1&gt;
      &lt;tag2&gt;ruby-on-rails&lt;/tag2&gt;
      &lt;tag3&gt;arrays&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;alecxe&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/771848/alecxe&lt;/link&gt;
      &lt;location&gt;New York, United States&lt;/location&gt;
      &lt;year_rep&gt;4,723&lt;/year_rep&gt;
      &lt;total_rep&gt;233,368&lt;/total_rep&gt;
      &lt;tag1&gt;python&lt;/tag1&gt;
      &lt;tag2&gt;selenium&lt;/tag2&gt;
      &lt;tag3&gt;protractor&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Jean-François Fabre&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/6451573/jean-fran%c3%a7ois-fabre&lt;/link&gt;
      &lt;location&gt;Toulouse, France&lt;/location&gt;
      &lt;year_rep&gt;4,526&lt;/year_rep&gt;
      &lt;total_rep&gt;30,027&lt;/total_rep&gt;
      &lt;tag1&gt;python&lt;/tag1&gt;
      &lt;tag2&gt;python-3.x&lt;/tag2&gt;
      &lt;tag3&gt;python-2.7&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;piRSquared&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/2336654/pirsquared&lt;/link&gt;
      &lt;location&gt;Bellevue, WA, United States&lt;/location&gt;
      &lt;year_rep&gt;4,482&lt;/year_rep&gt;
      &lt;total_rep&gt;41,183&lt;/total_rep&gt;
      &lt;tag1&gt;pandas&lt;/tag1&gt;
      &lt;tag2&gt;python&lt;/tag2&gt;
      &lt;tag3&gt;dataframe&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;CommonsWare&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/115145/commonsware&lt;/link&gt;
      &lt;location&gt;Who Wants to Know?&lt;/location&gt;
      &lt;year_rep&gt;4,475&lt;/year_rep&gt;
      &lt;total_rep&gt;616,135&lt;/total_rep&gt;
      &lt;tag1&gt;android&lt;/tag1&gt;
      &lt;tag2&gt;java&lt;/tag2&gt;
      &lt;tag3&gt;android-intent&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Quentin&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/19068/quentin&lt;/link&gt;
      &lt;location&gt;United Kingdom&lt;/location&gt;
      &lt;year_rep&gt;4,464&lt;/year_rep&gt;
      &lt;total_rep&gt;509,365&lt;/total_rep&gt;
      &lt;tag1&gt;javascript&lt;/tag1&gt;
      &lt;tag2&gt;html&lt;/tag2&gt;
      &lt;tag3&gt;css&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Jon Skeet&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/22656/jon-skeet&lt;/link&gt;
      &lt;location&gt;Reading, United Kingdom&lt;/location&gt;
      &lt;year_rep&gt;4,348&lt;/year_rep&gt;
      &lt;total_rep&gt;921,690&lt;/total_rep&gt;
      &lt;tag1&gt;c#&lt;/tag1&gt;
      &lt;tag2&gt;java&lt;/tag2&gt;
      &lt;tag3&gt;.net&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Felix Kling&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/218196/felix-kling&lt;/link&gt;
      &lt;location&gt;Sunnyvale, CA&lt;/location&gt;
      &lt;year_rep&gt;4,324&lt;/year_rep&gt;
      &lt;total_rep&gt;411,535&lt;/total_rep&gt;
      &lt;tag1&gt;javascript&lt;/tag1&gt;
      &lt;tag2&gt;jquery&lt;/tag2&gt;
      &lt;tag3&gt;asynchronous&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;matt&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/341994/matt&lt;/link&gt;
      &lt;location&gt;&lt;/location&gt;
      &lt;year_rep&gt;4,313&lt;/year_rep&gt;
      &lt;total_rep&gt;220,515&lt;/total_rep&gt;
      &lt;tag1&gt;swift&lt;/tag1&gt;
      &lt;tag2&gt;ios&lt;/tag2&gt;
      &lt;tag3&gt;xcode&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Psidom&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/4983450/psidom&lt;/link&gt;
      &lt;location&gt;Atlanta, GA, United States&lt;/location&gt;
      &lt;year_rep&gt;4,236&lt;/year_rep&gt;
      &lt;total_rep&gt;36,950&lt;/total_rep&gt;
      &lt;tag1&gt;python&lt;/tag1&gt;
      &lt;tag2&gt;pandas&lt;/tag2&gt;
      &lt;tag3&gt;r&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Martin R&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/1187415/martin-r&lt;/link&gt;
      &lt;location&gt;Germany&lt;/location&gt;
      &lt;year_rep&gt;4,195&lt;/year_rep&gt;
      &lt;total_rep&gt;269,380&lt;/total_rep&gt;
      &lt;tag1&gt;swift&lt;/tag1&gt;
      &lt;tag2&gt;ios&lt;/tag2&gt;
      &lt;tag3&gt;swift3&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Barmar&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/1491895/barmar&lt;/link&gt;
      &lt;location&gt;Arlington, MA&lt;/location&gt;
      &lt;year_rep&gt;4,179&lt;/year_rep&gt;
      &lt;total_rep&gt;289,989&lt;/total_rep&gt;
      &lt;tag1&gt;javascript&lt;/tag1&gt;
      &lt;tag2&gt;php&lt;/tag2&gt;
      &lt;tag3&gt;jquery&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Alexey Mezenin&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/1227923/alexey-mezenin&lt;/link&gt;
      &lt;location&gt;??????&lt;/location&gt;
      &lt;year_rep&gt;4,142&lt;/year_rep&gt;
      &lt;total_rep&gt;31,602&lt;/total_rep&gt;
      &lt;tag1&gt;laravel&lt;/tag1&gt;
      &lt;tag2&gt;php&lt;/tag2&gt;
      &lt;tag3&gt;laravel-5.3&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;BalusC&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/157882/balusc&lt;/link&gt;
      &lt;location&gt;Amsterdam, Netherlands&lt;/location&gt;
      &lt;year_rep&gt;4,046&lt;/year_rep&gt;
      &lt;total_rep&gt;703,046&lt;/total_rep&gt;
      &lt;tag1&gt;java&lt;/tag1&gt;
      &lt;tag2&gt;jsf&lt;/tag2&gt;
      &lt;tag3&gt;servlets&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;GurV&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/6348498/gurv&lt;/link&gt;
      &lt;location&gt;&lt;/location&gt;
      &lt;year_rep&gt;4,016&lt;/year_rep&gt;
      &lt;total_rep&gt;7,932&lt;/total_rep&gt;
      &lt;tag1&gt;sql&lt;/tag1&gt;
      &lt;tag2&gt;mysql&lt;/tag2&gt;
      &lt;tag3&gt;sql-server&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Nina Scholz&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/1447675/nina-scholz&lt;/link&gt;
      &lt;location&gt;Berlin, Deutschland&lt;/location&gt;
      &lt;year_rep&gt;3,950&lt;/year_rep&gt;
      &lt;total_rep&gt;61,135&lt;/total_rep&gt;
      &lt;tag1&gt;javascript&lt;/tag1&gt;
      &lt;tag2&gt;arrays&lt;/tag2&gt;
      &lt;tag3&gt;object&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;JB Nizet&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/571407/jb-nizet&lt;/link&gt;
      &lt;location&gt;Saint-Etienne, France&lt;/location&gt;
      &lt;year_rep&gt;3,923&lt;/year_rep&gt;
      &lt;total_rep&gt;418,780&lt;/total_rep&gt;
      &lt;tag1&gt;java&lt;/tag1&gt;
      &lt;tag2&gt;hibernate&lt;/tag2&gt;
      &lt;tag3&gt;java-8&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Frank van Puffelen&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/209103/frank-van-puffelen&lt;/link&gt;
      &lt;location&gt;San Francisco, CA&lt;/location&gt;
      &lt;year_rep&gt;3,920&lt;/year_rep&gt;
      &lt;total_rep&gt;86,520&lt;/total_rep&gt;
      &lt;tag1&gt;firebase&lt;/tag1&gt;
      &lt;tag2&gt;firebase-database&lt;/tag2&gt;
      &lt;tag3&gt;android&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;dasblinkenlight&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/335858/dasblinkenlight&lt;/link&gt;
      &lt;location&gt;United States&lt;/location&gt;
      &lt;year_rep&gt;3,886&lt;/year_rep&gt;
      &lt;total_rep&gt;475,813&lt;/total_rep&gt;
      &lt;tag1&gt;c#&lt;/tag1&gt;
      &lt;tag2&gt;java&lt;/tag2&gt;
      &lt;tag3&gt;c++&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Tim Biegeleisen&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/1863229/tim-biegeleisen&lt;/link&gt;
      &lt;location&gt;Singapore&lt;/location&gt;
      &lt;year_rep&gt;3,814&lt;/year_rep&gt;
      &lt;total_rep&gt;77,211&lt;/total_rep&gt;
      &lt;tag1&gt;sql&lt;/tag1&gt;
      &lt;tag2&gt;mysql&lt;/tag2&gt;
      &lt;tag3&gt;java&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Greg Hewgill&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/893/greg-hewgill&lt;/link&gt;
      &lt;location&gt;Christchurch, New Zealand&lt;/location&gt;
      &lt;year_rep&gt;3,796&lt;/year_rep&gt;
      &lt;total_rep&gt;529,137&lt;/total_rep&gt;
      &lt;tag1&gt;git&lt;/tag1&gt;
      &lt;tag2&gt;python&lt;/tag2&gt;
      &lt;tag3&gt;git-pull&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;unutbu&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/190597/unutbu&lt;/link&gt;
      &lt;location&gt;&lt;/location&gt;
      &lt;year_rep&gt;3,735&lt;/year_rep&gt;
      &lt;total_rep&gt;401,595&lt;/total_rep&gt;
      &lt;tag1&gt;python&lt;/tag1&gt;
      &lt;tag2&gt;pandas&lt;/tag2&gt;
      &lt;tag3&gt;numpy&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Hans Passant&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/17034/hans-passant&lt;/link&gt;
      &lt;location&gt;Madison, WI&lt;/location&gt;
      &lt;year_rep&gt;3,688&lt;/year_rep&gt;
      &lt;total_rep&gt;672,118&lt;/total_rep&gt;
      &lt;tag1&gt;c#&lt;/tag1&gt;
      &lt;tag2&gt;.net&lt;/tag2&gt;
      &lt;tag3&gt;winforms&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Jonathan Leffler&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/15168/jonathan-leffler&lt;/link&gt;
      &lt;location&gt;California, USA&lt;/location&gt;
      &lt;year_rep&gt;3,649&lt;/year_rep&gt;
      &lt;total_rep&gt;455,157&lt;/total_rep&gt;
      &lt;tag1&gt;c&lt;/tag1&gt;
      &lt;tag2&gt;bash&lt;/tag2&gt;
      &lt;tag3&gt;unix&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;paxdiablo&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/14860/paxdiablo&lt;/link&gt;
      &lt;location&gt;&lt;/location&gt;
      &lt;year_rep&gt;3,636&lt;/year_rep&gt;
      &lt;total_rep&gt;507,043&lt;/total_rep&gt;
      &lt;tag1&gt;c&lt;/tag1&gt;
      &lt;tag2&gt;c++&lt;/tag2&gt;
      &lt;tag3&gt;bash&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Pranav C Balan&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/3037257/pranav-c-balan&lt;/link&gt;
      &lt;location&gt;Ramanthali, Kannur, Kerala, India&lt;/location&gt;
      &lt;year_rep&gt;3,604&lt;/year_rep&gt;
      &lt;total_rep&gt;64,476&lt;/total_rep&gt;
      &lt;tag1&gt;javascript&lt;/tag1&gt;
      &lt;tag2&gt;jquery&lt;/tag2&gt;
      &lt;tag3&gt;html&lt;/tag3&gt;
    &lt;/topusers&gt;
    &lt;topusers&gt;
      &lt;user&gt;Suragch&lt;/user&gt;
      &lt;link&gt;http://www.stackoverflow.com//users/3681880/suragch&lt;/link&gt;
      &lt;location&gt;Hohhot, China&lt;/location&gt;
      &lt;year_rep&gt;3,580&lt;/year_rep&gt;
      &lt;total_rep&gt;71,032&lt;/total_rep&gt;
      &lt;tag1&gt;swift&lt;/tag1&gt;
      &lt;tag2&gt;ios&lt;/tag2&gt;
      &lt;tag3&gt;android&lt;/tag3&gt;
    &lt;/topusers&gt;
  &lt;/stackoverflow&gt;
  </code></pre>
  
  <p><strong>Python</strong> Methods</p>
  
  <pre><code>import xml.etree.ElementTree as et
  import pandas as pd
  from io import StringIO
  from lxml import etree as lxet
  
  def read_xml_iterfind():
      tree = et.parse('Input.xml')
  
      data = []
      inner = {}
      for el in tree.iterfind('./*'):
          for i in el.iterfind('*'):
              inner[i.tag] = i.text
          data.append(inner)
          inner = {}
  
      df = pd.DataFrame(data)
  
  def read_xml_iterparse():
      data = []
      inner = {}
      i = 1
      for (ev, el) in et.iterparse(path):
          if i &lt;= 2:
             first_tag = el.tag
  
          if el.tag == first_tag and len(inner) != 0:
              data.append(inner)            
              inner = {}
  
          if el.text is not None and len(el.text.strip()) &gt; 0:
              inner[el.tag] = el.text
      i += 1
  
      df = pd.DataFrame(data)    
  
  def read_xml_lxml_xpath():     
      tree = lxet.parse('Input.xml')
  
      data = []
      inner = {}
      for el in tree.xpath('/*/*'):
          for i in el:
              inner[i.tag] = i.text
          data.append(inner)
          inner = {}
  
      df = pd.DataFrame(data)
  
  def read_xml_lxml_xsl():     
      xml = lxet.parse('Input.xml')
  
      xslstr = '''
      &lt;xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;
          &lt;xsl:output version="1.0" encoding="UTF-8" indent="yes"  method="text"/&gt;
          &lt;xsl:strip-space elements="*"/&gt;
  
          &lt;!-- HEADERS --&gt;
          &lt;xsl:template match = "/*"&gt;
              &lt;xsl:for-each select="*[1]/*"&gt;
                &lt;xsl:value-of select="local-name()" /&gt;
                  &lt;xsl:choose&gt;
                     &lt;xsl:when test="position() != last()"&gt;
                        &lt;xsl:text&gt;,&lt;/xsl:text&gt;
                     &lt;/xsl:when&gt;
                     &lt;xsl:otherwise&gt;
                        &lt;xsl:text&gt;&amp;#xa;&lt;/xsl:text&gt;
                     &lt;/xsl:otherwise&gt;                              
                  &lt;/xsl:choose&gt;   
              &lt;/xsl:for-each&gt;
              &lt;xsl:apply-templates/&gt;
          &lt;/xsl:template&gt;
  
          &lt;!-- DATA ROWS (COMMA-SEPARATED) --&gt;
          &lt;xsl:template match="/*/*" priority="2"&gt;    
              &lt;xsl:for-each select="*"&gt;
                &lt;xsl:if test="position() = 1"&gt;
                     &lt;xsl:text&gt;&amp;quot;&lt;/xsl:text&gt;
                &lt;/xsl:if&gt;
                &lt;xsl:value-of select="." /&gt;
                  &lt;xsl:choose&gt;
                     &lt;xsl:when test="position() != last()"&gt;
                        &lt;xsl:text&gt;&amp;quot;,&amp;quot;&lt;/xsl:text&gt;
                     &lt;/xsl:when&gt;
                     &lt;xsl:otherwise&gt;
                        &lt;xsl:text&gt;&amp;quot;&amp;#xa;&lt;/xsl:text&gt;
                     &lt;/xsl:otherwise&gt;                              
                  &lt;/xsl:choose&gt;
              &lt;/xsl:for-each&gt;
          &lt;/xsl:template&gt;
  
      &lt;/xsl:transform&gt;
      '''
      xsl = lxet.fromstring(xslstr)
  
      transform = lxet.XSLT(xsl)
      newdom = transform(xml)
  
      df = pd.read_csv(StringIO(str(newdom)))
  </code></pre>
  
  <p><strong>Timings</strong> <em>(with current XML and XML with 25 times the children (i.e., 900 StackOverflow user records)</em></p>
  
  <pre><code># SHORTER FILE
  python -mtimeit -s'import readxml_test_runs as test' 'test.read_xml_iterfind()'
  100 loops, best of 3: 3.87 msec per loop
  
  python -mtimeit -s'import readxml_test_runs as test' 'test.read_xml_iterparse()'
  100 loops, best of 3: 5.5 msec per loop
  
  python -mtimeit -s'import readxml_test_runs as test' 'test.read_xml_lxml_xpath()'
  100 loops, best of 3: 3.86 msec per loop
  
  python -mtimeit -s'import readxml_test_runs as test' 'test.read_xml_lxml_xsl()'
  100 loops, best of 3: 5.68 msec per loop
  
  # LARGER FILE
  python -mtimeit -n'100' -s'import readxml_test_runs as test' 'test.read_xml_iterfind()'
  100 loops, best of 3: 36 msec per loop
  
  python -mtimeit -n'100' -s'import readxml_test_runs as test' 'test.read_xml_iterparse()'
  100 loops, best of 3: 78.9 msec per loop
  
  python -mtimeit -n'100' -s'import readxml_test_runs as test' 'test.read_xml_lxml_xpath()'
  100 loops, best of 3: 32.7 msec per loop
  
  python -mtimeit -n'100' -s'import readxml_test_runs as test' 'test.read_xml_lxml_xsl()'
  100 loops, best of 3: 51.4 msec per loop
  </code></pre>