Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: module 'pandas' has no attribute 'read_xml' or 'to_xml'

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?

like image 340
pysolver33 Avatar asked Jun 28 '21 16:06

pysolver33


1 Answers

Update pandas to the newest version.

pip install --upgrade pandas --user

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

like image 188
Jantai Aquiles Avatar answered Oct 20 '22 21:10

Jantai Aquiles