to_html()没有encoding参数?造成输出中文显示乱码 · Issue #28663 · pandas-dev/pandas (original) (raw)

Code Sample, a copy-pastable example if possible

Your code here

data = pd.read_csv("test.csv",encoding="gbk") print(data) html = data.to_html(col_space=40,justify="center")

Problem description

当我用to_html()方法生成html的时候,中文显示乱码,后来一看该方法竟然没有encoding参数,希望作者能完善了,这样以后会方便很多人哈!
[this should explain why the current behaviour is a problem and why the expected output is a better solution.]

Note: We receive a lot of issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates!

Note: Many problems can be resolved by simply upgrading pandas to the latest version. Before submitting, please check if that solution works for you. If possible, you may want to check if master addresses this issue, but that is not necessary.

For documentation-related issues, you can check the latest versions of the docs on master here:

https://pandas-docs.github.io/pandas-docs-travis/

If the issue has not been resolved there, go ahead and file it in the issue tracker.

Expected Output

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]