简体   繁体   English

在 python 中使用 pandas 打印 CSV 文件时出现问题

[英]Problem printing a CSV file with pandas in python

I have school project to submit by Sunday and I have a problem here , CSV file我有学校项目要在周日之前提交,我在这里遇到问题, CSV 文件

import pandas as PD
DF=PD.read_csv('C:\New folder\Book4.csv')
print(DF)

This isn't the entire code but this part is the only issue.这不是整个代码,但这部分是唯一的问题。 I have 4 CSV files in total and only this one is not printing the middle column for some reason.我总共有 4 个 CSV 文件,只有这个文件由于某种原因没有打印中间列。 I had this issue before when I was trying to print second csv file but that just printed correctly after I added the third and fourth(this one) CSV file and this one got the problem我在尝试打印第二个 csv 文件之前遇到了这个问题,但是在我添加第三个和第四个(这个)CSV 文件之后才正确打印,这个有问题
please help.请帮忙。

You probably have too many columns in this CSV.您可能在此 CSV 中有太多列。 You can set the number of columns to print:您可以设置要打印的列数:

 pd.set_option('display.max_columns',40)

The above code will increase the maximum to 40 columns上面的代码会将最大值增加到 40 列

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

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