microsoft / python-in-excel

Python in Microsoft Excel
MIT License
517 stars 34 forks source link

Named DataFrame indices shouldn't introduce an empty row between header and data #43

Open fzumstein opened 11 months ago

fzumstein commented 11 months ago

When showing Values of a DataFrame with a named index, it introduces an empty row between header and data. There's no reason for it though, and pd.to_excel() doesn't do it either (even if there's additionally a df.columns.name!). So currently, you'd have to do df.reset_index() to format it correctly.

Screenshot 2023-10-16 at 4 35 02 PM
keyur32 commented 11 months ago

Thanks for the report, I agree I'd expect not to have a blank row in this case as well (might be a regression). Marking as a bug so we can follow up with the team

KimJun9011 commented 11 months ago

df - with extra space If you try the same example on standard jupyter environment, you will see the exact same space allocated. I do not see this as an issue.

fzumstein commented 11 months ago

That's right, because Jupyter notebooks leave space for a potential columns name, but that concept doesn't really translate to Excel (see e.g., Excel tables).