Elliot Gitter
Elliot Gitter

Reputation: 60

Pandas read_xml - AttributeError: module 'pandas' has no attribute 'read_xml'

I ran into the error:

" AttributeError: module 'pandas' has no attribute 'read_xml' "

This would be a huge lifesaver if I could ingest the XML with one function into a pandas df without trying to iterate through etc.

I am running pandas 1.3.4 and python 3.8.8. I have tried opening an xml in my local folder (where the script is housed).

I tried directly importing the file like so:

df = pd.read_xml('xmltest.xml')

As well as trying to import via a string like so:

txt = Path('xmltest.txt').read_text()

df = pd.read_xml(txt)

And both gave me the wrong error.. Any help would be awesome as this would be AMAZING to ingest XML with 1 function into a DF!!! Are there similar functions out there if this is no longer a valid solution?

It appears this person had the same problem but I'm currently running the updated pandas:

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

Upvotes: 0

Views: 1268

Answers (0)

Related Questions