microsoft / microsoft/markitdown
XLSX/XLS: whole numbers render as "1.0" when the column contains a blank cell
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 186k
- Forks
- 13.7k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 49
Description
Description
In XLSX/XLS conversion, a single blank cell forces pandas to read its column as float64, so every whole number in that column renders with a .0 suffix, inconsistent with clean columns beside it:
# sheet: A1='count', A2=1, A3 blank, A4=2
from markitdown import MarkItDown, StreamInfo
...
'| count |',
'| 1.0 |',
'| NaN |',
'| 2.0 |',
Expected the integer rendering of clean columns: 1, 2.
Reproduction
import io
from openpyxl import Workbook
from markitdown import MarkItDown, StreamInfo
wb = Workbook(); ws = wb.active
ws['A1'] = 'count'; ws['A2'] = 1; ws['A3'] = None; ws['A4'] = 2
buf = io.BytesIO(); wb.save(buf); buf.seek(0)
print(MarkItDown().convert_stream(buf, stream_info=StreamInfo(extension='.xlsx')).markdown)
No network or fixture needed.
Notes
Distinct from the NaN-noise discussion in #2124 / #2286: simulating their patch still renders 1.0 for a numeric-header/data-only sheet, so the float64 promotion is a separate defect.
Environment
markitdown main (cc0ca9e), Python 3.12
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided openpyxl and MarkItDown().convert_stream reproduction for a .xlsx StreamInfo. Trace the XLSX/XLS conversion path and how pandas float64 values are rendered when a column contains a blank cell. Done means the sample output shows 1 and 2 rather than 1.0 and 2.0, while the blank cell remains represented as shown and existing clean-column behavior is preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100