title: Python: Extracting XML to DataFrame (Pandas)
body: <p>a have an XML file that looks like this:</p>
  
  <pre><code>﻿&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;comments&gt;
  &lt;row Id="1" PostId="2" Score="0" Text="(...)" CreationDate="2011-08-30T21:15:28.063" UserId="16" /&gt;
  &lt;row Id="2" PostId="17" Score="1" Text="(...)" CreationDate="2011-08-30T21:24:56.573" UserId="27" /&gt;
  &lt;row Id="3" PostId="26" Score="0" Text="(...)" UserId="9" /&gt;
  &lt;/comments&gt;
  </code></pre>
  
  <p>What I'm trying to do is to extract ID, Text and CreationDate colums into pandas DF and I've tryied following:</p>
  
  <pre><code>import xml.etree.cElementTree as et
  import pandas as pd
  path = '/.../...'
  dfcols = ['ID', 'Text', 'CreationDate']
  df_xml = pd.DataFrame(columns=dfcols)
  
  root = et.parse(path)
  rows = root.findall('.//row')
  for row in rows:
      ID = row.find('Id')
      text = row.find('Text')
      date = row.find('CreationDate')
      print(ID, text, date)
      df_xml = df_xml.append(pd.Series([ID, text, date], index=dfcols), ignore_index=True)
  
  print(df_xml)
  </code></pre>
  
  <p>But the output is:
  None None None</p>
  
  <p>Could you please tell how to fix this?
  THanks</p>