Clej
Clej

Reputation: 466

While parsing .ods file with pandas using read_excel() (and odf), how to drop comments in cells?

I'm trying to parse .ods files with pandas, using pd.read_excel() function, which uses odf under the hood. The problem I face is simple: some cells have comments, and pandas treat them as if they were some regular content.

Here is a basic example ; given a very simple .ods file with a single comment:

enter image description here

Importing that file into a dataframe using

import pandas as pd 
df = pd.read_excel("example_with_comment.ods")

gives:

enter image description here

while I would have liked to retrieve the content of the cell only. Does anyone know how to drop the comments during parsing ?

I'm using pandas 1.3.4.

Thanks a lot to anyone who could give me a hint !

Upvotes: 3

Views: 2356

Answers (1)

Liutprand
Liutprand

Reputation: 557

It seems like a bug. You may try, instead of read_excel, to use this module:

https://pypi.org/project/pandas-ods-reader/

Upvotes: 2

Related Questions