Reputation: 113
I'm new to Jupyter Notebooks. Taking a python for finance course, and right at the start ran into this problem.
import pandas as pd
import matplotlib.pyplot as plt
def test_run():
df = pd.read_csv("C:/Users/James/Desktop/MSFT.csv")
print(df)
this runs no errors, but just does not print anything under the cell. I know this must be a silly thing i'm not doing, but I can't figure it out, any help greatly appreciated.
Upvotes: 2
Views: 4969
Reputation: 821
If the above code is exactly what you're executing, then the code will not output anything.
You are defining a function, but not running that function. The function (when run) will print something to the console (stdout). If run in a jupyter notebook, the output will display in the output cell. However, you are not running the function.
The below should print to the jupyter notebook
import pandas as pd
import matplotlib.pyplot as plt
def test_run():
df = pd.read_csv("C:/Users/James/Desktop/MSFT.csv")
print(df)
test_run() # run the function
Upvotes: 3