Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: manage raw ods file without cell cache #55219

Merged
merged 2 commits into from
Sep 20, 2023

Conversation

guillett
Copy link
Contributor

@guillett guillett commented Sep 20, 2023

import ezodf
ods = ezodf.newdoc("ods", "test_unempty_cells.ods")
sheet = ezodf.Sheet("base", size=(6, 1))
ods.sheets += sheet

sheet[0, 0].set_value("Column 1")
for i in range(1, 6, 2):
    sheet[i, 0].set_value(i)
    #sheet[i, 0].append(ezodf.Paragraph(str(i)))
ods.save()

should generate

Column 1
0 1
1 nan
2 3
3 nan
4 5

but it generates (an empty DataFrame)

Column 1

A hacky fix in building the ODS file is commented out in the snippet sheet[i, 0].append(ezodf.Paragraph(str(i))).
There is a cache in ODS file and data is correctly read from the origin but the logic to determine if a full row is empty mistakenly relies on the cache.

This PR removes that logic et fixes the bug.

@mroeschke mroeschke added this to the 2.2 milestone Sep 20, 2023
@mroeschke mroeschke added the IO Excel read_excel, to_excel label Sep 20, 2023
@mroeschke mroeschke merged commit 8371d18 into pandas-dev:main Sep 20, 2023
36 checks passed
@mroeschke
Copy link
Member

Nice thanks @guillett

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO Excel read_excel, to_excel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants