3

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?

user3848207
  • 3,737
  • 17
  • 59
  • 104

1 Answers1

6

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.

Vikash Singh
  • 13,213
  • 8
  • 40
  • 70
  • Do I need to be using Jupyter to put `data_pandas` in a cell? I am using pycharm, not Jupyter. – user3848207 Mar 04 '17 at 03:15
  • oh 2 mins. checking. – Vikash Singh Mar 04 '17 at 03:17
  • @user3848207 You can run a jupyter notebook in pycharm as well, if you like. Btw, if you are doing analysis, notebook will be better than a dev environment. But with print(data_pandas), you should be able to see it in the console when you run the python file. – Psidom Mar 04 '17 at 03:21