I have the following code in PyCharm.
import pandas as pd
df = pd.read_csv("test.csv")
print(df)
print(df.head())
But nothing shows up, and I get:
Process finished with exit code 0
How can I have data showing in PyCharm like in RStudio?
I have the following code in PyCharm.
import pandas as pd
df = pd.read_csv("test.csv")
print(df)
print(df.head())
But nothing shows up, and I get:
Process finished with exit code 0
How can I have data showing in PyCharm like in RStudio?
First check the shape of df using df.shape()
to get some insights and make sure that it is not empty.
Use Debugger and place a debug point at print(df)
.
There is evaluator in debugger and you will be shown a view of df
if you evaluate df.
It's been a while this question was posted, but as I ended up here looking for an answer and found it elsewhere, I'll answer it. Maybe it can help someone else.
I solved it installing the package Tabulate: https://pypi.org/project/tabulate/
It's pretty straightforward to use. You import it:
from tabulate import tabulate
And then print your DataFrame:
print(tabulate(df, headers='keys'))
I saw it here.
When you read csv you need to check you have read successfully. Does the file located in the same folder? Does it not empty?
Concerning your second question:
You can use something called Jupyter notebook in PyCharm, but I would not recommend it, because it does not feel handy and looks very odd. Jupyter Notebook in the browser is much more appealing.
This is how Jupyter Notebook looks in PyCharm: