Reputation:
I have the following code in PyCharm
import pandas as pd
import numpy as np
import matplotlib as plt
df = pd.read_csv("c:/temp/datafile.txt", sep='\t')
df.head(10)
I get the following output:
Process finished with exit code 0
I am supposed to get the first ten rows of my datafile, but these do not appear in PyCharm
.
I checked the Project interpreter and all settings seem to be alright there. The right packages are installed (numpy, pandas, matplotlib) under the right Python version.
What am I doing wrong? Thanks.
Upvotes: 24
Views: 20515
Reputation: 142631
PyCharm
is not Python Shell
which automatically prints all results.
In PyCharm
you have to use print()
to display anything.
print(df.head(10))
The same is when you run script in other IDE
or editor
or directly python script.py
Upvotes: 45
Reputation: 998
For printing all data
print(df)
By Default it will print top 5 records for head.
print(df.head())
If you need 10 rows then you can write this way
print(df.head(10))
Upvotes: 1
Reputation: 15
I did File-Invalidate Caches/Restart Option Invalidate and after that I was able to get the head:
Upvotes: -1