Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display data in pandas dataframe

This code allows me to display panda dataframe contents in Jupyter notebook.

import pandas as pd
# create a simple dataset of people
data = {'Name': ["John", "Anna", "Peter", "Linda"],
'Location' : ["New York", "Paris", "Berlin", "London"],
'Age' : [24, 13, 53, 33]
}
data_pandas = pd.DataFrame(data)
# IPython.display allows "pretty printing" of dataframes
# in the Jupyter notebook
display(data_pandas)

However, I am not using Jupyter notebook. I am using pycharm and Anaconda (python v3.6). How should I display data_pandas if I am not using Jupyter?

like image 609
user3848207 Avatar asked Sep 03 '25 09:09

user3848207


1 Answers

put data_pandas in a cell and run that cell. It will display the content in output.

enter image description here

To be able to do the same thing in pycharm you will have to run anaconda notebook from pycharm. Which works like this: https://www.jetbrains.com/help/pycharm/2016.3/using-ipython-jupyter-notebook-with-pycharm.html

Then it's basically same as running a normal jupyter notebook on a different browser.

If you are running a normal python program and want an inline output, it's not going to happen. You will have to at least run an Ipython program to do so. Iteractive python.

like image 126
Vikash Singh Avatar answered Sep 04 '25 23:09

Vikash Singh