hupili / python-for-data-and-media-communication-gitbook

An open source book on Python tailed for communication students with zero background
117 stars 62 forks source link

How to print csv file in Jupyter notebook #159

Open MindyZHAOMinzhu opened 5 years ago

MindyZHAOMinzhu commented 5 years ago

My environment

My question

I write a csv file, but I can not print contents in it. Additionally, I cannot get the same outcomes as noted in the openbook.

屏幕快照 2019-07-27 上午9 52 02

Describe the efforts you have spent on this issue

I Google it but do not find the answer. I have ask Chenxi and solve the problem.

MindyZHAOMinzhu commented 5 years ago

The problem is :I just write a csv file, but if I want to print it. I should read it first. Additionally, if I want to print the contents of the csv file, I should use for loop . to print every row.

屏幕快照 2019-07-27 上午10 09 24
ConnorLi96 commented 5 years ago

Great, you actually solve this problem!

Other Tips: Please notice the path by using “pwd ”when you run read csv, otherwise there will be errors that cannot find csv file.

hupili commented 5 years ago

Another way to quickly check text file content is to use cat command.

In Jupyter notebook, it becomes: !cat file-name-of-your-csv.csv