Output from dataframe_to_rows changed from 2.5.1 to 2.5.2

Issue #1018 resolved
Kristoffer Føllesdal
created an issue

Hi,
noticed that the output from the function dataframe_to_rows in openpyxl.utils.dataframe changed from version 2.5.1 to 2.5.2.

from pandas import DataFrame
from openpyxl.utils.dataframe import dataframe_to_rows

d = DataFrame([1,2,3])
print(list(dataframe_to_rows(d, index=True, header=True)))
# Output 2.5.1: 
[[None, 0], [0, 1], [1, 2], [2, 3]]

# Output 2.5.2: 
[[None, 0], FrozenList([None]), [0, 1], FrozenList([None]), [1, 2], FrozenList([None]), [2, 3]]

When we write the result to a worksheet the Forzenlist elements make a blank row in between the data.

This is change of output is probably not intended?

Comments (3)

  1. CharlieC

    The change is intended and explained in the docstring. The output now matches what pandas itself will show when index=True which puts the index in its own row whether or not the headers are displayed. This is consistent and reliable.

  2. Jack Slater

    2.5.3
    [[None, 0], FrozenList([None]), [0, 1], [1, 2], [2, 3]]

    The result to a worksheet the Forzenlist elements make a blank row in between the header and the first data.

  3. Log in to comment