\n
Importing that file into a dataframe using
\nimport pandas as pd \ndf = pd.read_excel("example_with_comment.ods")\n
\ngives:
\n\nwhile I would have liked to retrieve the content of the cell only.\nDoes anyone know how to drop the comments during parsing ?
\nI'm using pandas 1.3.4.
\nThanks a lot to anyone who could give me a hint !
\n","author":{"@type":"Person","name":"Clej"},"upvoteCount":3,"answerCount":1,"acceptedAnswer":null}}Reputation: 466
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:
Importing that file into a dataframe using
import pandas as pd
df = pd.read_excel("example_with_comment.ods")
gives:
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
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