BUG: manage raw ods file without cell cache by guillett · Pull Request #55219 · pandas-dev/pandas (original) (raw)
- Tests added and passed if fixing a bug or adding a new feature
- All code checks passed.
Added type annotations to new arguments/methods/functions.- Added an entry in the latest
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.
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.