简体   繁体   English

将文件从 jupyter notebook 上传到 github 时出错

[英]Error with uploading files from jupyter notebook to github

When I view my dataframe in Jupyter notebook everything looks fine, but when I upload it to github, the dataframe looks odd.当我在 Jupyter notebook 中查看我的数据框时,一切看起来都很好,但是当我将它上传到 github 时,数据框看起来很奇怪。

I have already tried different encodings when I use pandas.read_csv()我在使用 pandas.read_csv() 时已经尝试过不同的编码

Here is how the dataframe looks in github:以下是数据框在 github 中的外观:

这是数据框在 github 中的外观

Generally the best way to deal with Jupyter notebooks is to clean the output before uploading to GitHub using something like nbclean通常,处理 Jupyter notebook 的最佳方法是在使用nbclean 之类的东西上传到 GitHub 之前清理输出

And yes as per the comments @Joseph Seung Jae Dollar is correct, if you look in the pandas source code, there is some formatting / css stuff that is applied to prettify the dataframe ouput when it's being used in Jupyter是的,根据@Joseph Seung Jae Dollar 的评论是正确的,如果您查看 Pandas 源代码,就会发现在 Jupyter 中使用数据帧输出时,有一些格式/CSS 内容可用于美化数据帧输出

Short answer:简短的回答:

  • clean notebooks before committing (mostly so you don't accidentally commit sensitive information)在提交之前清理笔记本(主要是为了你不会不小心提交敏感信息)

  • ignore the what it looks like in GitHub忽略它在 GitHub 中的样子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM