Skip to content

Conversation

@phofl
Copy link
Member

@phofl phofl commented May 23, 2020

Should I add a whats new enty? Under which section?

https://github.com/phofl/pandas/blob/34331_render_column_name_raises_error_in_to_excel/pandas/io/formats/excel.py#L389

The previous code checked if the df had a attribute render. This check was True, if there was a DataFrame given as input with a column render. I think that this check should only be True if a Styler object is given, so I added an isinstace check for Styler.

Does the Styler object always an attribute render? If not, we would run into problems, if we get a Styler object with a column named render but without the render attribute. If a Styler object has always an attribute render, we could delete the hasattr check.

Edit: I changed the check to not isinstance(df, DataFrame) to avoid the jinja issues.

@dsaxton
Copy link
Contributor

dsaxton commented May 24, 2020

@phofl You can add a bug fix whatsnew note under the I/O section in pandas/doc/source/whatsnew/v1.1.0.rst

@phofl
Copy link
Member Author

phofl commented May 24, 2020

@phofl You can add a bug fix whatsnew note under the I/O section in pandas/doc/source/whatsnew/v1.1.0.rst

Àdded the whats new entry

@jreback jreback added IO Excel read_excel, to_excel Styler conditional formatting using DataFrame.style labels May 25, 2020
@phofl phofl requested a review from jreback May 25, 2020 21:20
@phofl phofl requested a review from jreback May 26, 2020 14:54
@jreback jreback added this to the 1.1 milestone May 26, 2020
@jreback jreback merged commit fc6dd8d into pandas-dev:master May 26, 2020
@jreback
Copy link
Contributor

jreback commented May 26, 2020

thanks @phofl very nice!

@phofl phofl deleted the 34331_render_column_name_raises_error_in_to_excel branch May 27, 2020 16:30
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 Styler conditional formatting using DataFrame.style

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: writing dataframe to excel if one of the rows has name "render" fails

3 participants