title: Read XML file to Pandas DataFrame
body: <p>Can someone please help convert the following XML file to Pandas dataframe:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;root&gt;
   &lt;bathrooms type="dict"&gt;
    &lt;n35237 type="number"&gt;1.0&lt;/n35237&gt;
    &lt;n32238 type="number"&gt;3.0&lt;/n32238&gt;
    &lt;n44699 type="number"&gt;nan&lt;/n44699&gt;
   &lt;/bathrooms&gt;
   &lt;price type="dict"&gt;
    &lt;n35237 type="number"&gt;7020000.0&lt;/n35237&gt;
    &lt;n32238 type="number"&gt;10000000.0&lt;/n32238&gt;
    &lt;n44699 type="number"&gt;4128000.0&lt;/n44699&gt;
   &lt;/price&gt;
   &lt;property_id type="dict"&gt;
    &lt;n35237 type="number"&gt;35237.0&lt;/n35237&gt;
    &lt;n32238 type="number"&gt;32238.0&lt;/n32238&gt;
    &lt;n44699 type="number"&gt;44699.0&lt;/n44699&gt;
   &lt;/property_id&gt;
  &lt;/root&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>It should look like this --</p>
  
  <p><a href="https://i.stack.imgur.com/XDk8E.png" rel="noreferrer">OUTPUT</a></p>
  
  <p>This is the code I have written:-</p>
  
  <pre><code>import pandas as pd
  import xml.etree.ElementTree as ET
  
  tree = ET.parse('real_state.xml')
  root = tree.getroot()
  
  dfcols = ['property_id', 'price', 'bathrooms']
  df_xml = pd.DataFrame(columns=dfcols)
  
  for node in root:
      property_id = node.attrib.get('property_id')
      price = node.attrib.get('price')
      bathrooms = node.attrib.get('bathrooms')
  
      df_xml = df_xml.append(
              pd.Series([property_id, price, bathrooms], index=dfcols),
              ignore_index=True)
  
  
  print(df_xml)
  </code></pre>
  
  <p>I am getting <em>None</em> everywhere, instead of the actual values. Can someone please tell how it can be fixed. Thanks!</p>