6

Im trying to parse feedly RSS feeds exported opml files into xml files.

I succeeded into doing so with my use of listparser, dicttoxml, and pandas. I wanted to try out pandas read_xml() and to_xml() to find out how it would perform compared to me parsing the opml to xml myself.

import pandas as pd
my_opml = './feedly-e42affb2-52f5-4889-8901-992e3a3e35de-2021-06-28.opml'
df = pd.read_xml(my_opml)

these would be the error that i get.

Traceback (most recent call last): File "", line 1, in File "/home/pysolver33/anaconda3/envs/feedly/lib/python3.9/site-packages/pandas/core/generic.py", line 5465, in getattr return object.getattribute(self, name) AttributeError: 'DataFrame' object has no attribute 'read_xml'

df.to_xml("feedlyRSS.xml")

Traceback (most recent call last): File "", line 1, in File "/home/pysolver33/anaconda3/envs/feedly/lib/python3.9/site-packages/pandas/init.py", line 244, in getattr raise AttributeError(f"module 'pandas' has no attribute '{name}'") AttributeError: module 'pandas' has no attribute 'read_xml'

My pandas version is 1.2.5. I checked pip and 1.2.5 should be the latest version. Is there a particular reason why i can't play with read_xml or to_xml?

pysolver33
  • 307
  • 1
  • 5
  • 13
  • 3
    `read_xml` will be available only in version 1.3, which hasn't been released yet. – Jack Fleeting Jun 28 '21 at 16:39
  • i see! thank you for telling me about it. i was reading both from the official documents and was confused why i can't use them. again thank you! – pysolver33 Jun 29 '21 at 03:08

1 Answers1

8

Update pandas to the newest version.

pip install --upgrade pandas --user

pd.read_xml('file.xml') is available in version 1.3.0.

Romain
  • 19,910
  • 6
  • 56
  • 65