Skip to content

Updated Dataframe.to_excel and Dataframe.to_latex #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 4, 2022
Merged

Updated Dataframe.to_excel and Dataframe.to_latex #179

merged 2 commits into from
Aug 4, 2022

Conversation

p5k369
Copy link
Contributor

@p5k369 p5k369 commented Aug 3, 2022

For both, header accepts boolean or a list of strings.

if TYPE_CHECKING: # skip pytest

df = pd.DataFrame(data={"col1": [1, 2], "col2": [3, 4]})
df.to_excel("foo.xlsx", startrow=1, startcol=1, header=False)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use the pattern that is in test_pandas.py with NamedTemporaryFile that is used to test to_csv() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is now no longer skipped by pytest.

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Aug 3, 2022

Looking into this, it seems that we are not supporting Series.to_excel() and Series.to_latex(), so we should fix these here as well.

Can you take to_excel() and to_latex() out of frame.pyi and then use just a common stub in core/generic.pyi ?

- added openpyxl to dev-requirements
- updated tests
@p5k369
Copy link
Contributor Author

p5k369 commented Aug 3, 2022

Can you take to_excel() and to_latex() out of frame.pyi and then use just a common stub in core/generic.pyi ?

Hey @Dr-Irv,
To be honest, I'm not sure what I had to do other than removing to_excel() and to_latex() from frame.pyi because they both were already present in generic.pyi. Did I misunderstand something?

@p5k369 p5k369 requested a review from Dr-Irv August 3, 2022 20:57
@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Aug 3, 2022

To be honest, I'm not sure what I had to do other than removing to_excel() and to_latex() from frame.pyi because they both were already present in generic.pyi. Did I misunderstand something?

No, but I wanted to make sure that the stubs in generic.pyi were the same as the ones in frame.pyi, and they were, so we're all good on that front.

Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @p5k369

@Dr-Irv Dr-Irv merged commit 257e761 into pandas-dev:main Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants