Skip to content
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

To html encoding add #28692

Merged
merged 18 commits into from
Oct 16, 2019
Merged

To html encoding add #28692

merged 18 commits into from
Oct 16, 2019

Conversation

cailurus
Copy link
Contributor

@cailurus cailurus commented Sep 30, 2019

added encoding argument to DataFrame.to_html()

pandas/core/frame.py Outdated Show resolved Hide resolved
@cailurus
Copy link
Contributor Author

hi @josibake , I found two checks failed but I just got [error]Bash exited with code '1' in azure log, could you give me some tips to fix this?

@josibake
Copy link

hey @ailurus1991 , if you look further up in the logs, it says that running black changed two files.

try running black pandas/core commit those changes.

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

Can you add a test for this - typically the first thing we would look at in review

@WillAyd WillAyd added the IO HTML read_html, to_html, Styler.apply, Styler.applymap label Oct 1, 2019
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

Thanks. Looks pretty good some minor questions. Can you also add a whatsnew for v1.0.0?

pandas/tests/io/formats/test_to_html.py Outdated Show resolved Hide resolved
pandas/tests/io/formats/test_to_html.py Outdated Show resolved Hide resolved
pandas/core/frame.py Outdated Show resolved Hide resolved
@WillAyd WillAyd added this to the 1.0 milestone Oct 2, 2019
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

lgtm - @simonjayhawkins care to take a look as well?

pandas/core/frame.py Show resolved Hide resolved
pandas/io/formats/format.py Outdated Show resolved Hide resolved
pandas/core/frame.py Outdated Show resolved Hide resolved
Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

@ailurus1991 Thanks for the PR. a few changes for the test. if possible the test should be a similar as possible to test_filepath_or_buffer_arg in test_formats.py.

if you can adapt that test instead, even better!

pandas/core/frame.py Outdated Show resolved Hide resolved
pandas/io/formats/format.py Outdated Show resolved Hide resolved
pandas/tests/io/formats/test_to_html.py Outdated Show resolved Hide resolved
pandas/tests/io/formats/test_to_html.py Outdated Show resolved Hide resolved
pandas/tests/io/formats/test_to_html.py Outdated Show resolved Hide resolved
@simonjayhawkins
Copy link
Member

@WillAyd if encoding is specified and not applicable we should presumably raise? Although I don't think it should be part of this PR. Something to think about so we're consistent across the IO methods.

@simonjayhawkins
Copy link
Member

@WillAyd if encoding is specified and not applicable we should presumably raise? Although I don't think it should be part of this PR. Something to think about so we're consistent across the IO methods.

#28766 (comment) "We should raise when encoding is specified and it's buf isn't a string path."

@simonjayhawkins
Copy link
Member

Although I don't think it should be part of this PR.

maybe it should. Since this is effectively an enhancement then it may be worth getting it right off the bat.

…ged, and replace the ensure_clean and DF with pytest built-in tmp_path and float_frame fixture
@jreback
Copy link
Contributor

jreback commented Oct 8, 2019

@ailurus1991 looks ok, can you add a whtasnew note in other enhancements section

Co-Authored-By: Simon Hawkins <simonjayhawkins@gmail.com>
Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

@ailurus1991 lgtm @jreback

@cailurus
Copy link
Contributor Author

@ailurus1991 looks ok, can you add a whtasnew note in other enhancements section

@jreback Hi Jeff, I added a simple whatsnew in doc, could you review it? thx

@@ -312,6 +312,7 @@ I/O
- Bug in :meth:`DataFrame.to_json` where a datetime column label would not be written out in ISO format with ``orient="table"`` (:issue:`28130`)
- Bug in :func:`DataFrame.to_parquet` where writing to GCS would fail with `engine='fastparquet'` if the file did not already exist (:issue:`28326`)
- Bug in :meth:`DataFrame.to_html` where the length of the ``formatters`` argument was not verified (:issue:`28469`)
- Added ``encoding`` argument to :func:`DataFrame.to_html` for non-ascii text (:issue:`28663`)
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

move to other enhancements section

@simonjayhawkins simonjayhawkins mentioned this pull request Oct 15, 2019
5 tasks
Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

@ailurus1991 Thanks for moving the whatsnew @jreback

@jreback jreback merged commit 79a5f7c into pandas-dev:master Oct 16, 2019
@jreback
Copy link
Contributor

jreback commented Oct 16, 2019

thanks

proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
bongolegend pushed a commit to bongolegend/pandas that referenced this pull request Jan 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO HTML read_html, to_html, Styler.apply, Styler.applymap
Projects
None yet
Development

Successfully merging this pull request may close these issues.

to_html()没有encoding参数?造成输出中文显示乱码
5 participants