Hi. I'm currently working on Jupyter notebook and tried to practice on Spyder IDE. The problem is that I don't get the same output on both tools. In example:
type(tickerDf) show the type of the variable on Jupyter notebook but no output in Spyder.
print(type(tickerDf)) works in Spyder
My question: Is there any way to fix this or is a good practice to always program using print?
Thanks for your time.
Hello Andreas,
This is because Jupyter prints any variable/object name or function output ( unless stored in a variable ) in the last line of the cell by default. This is because it's a python shell which works on GUI. You are running an ipynb file in Jupyter.
On the other hand in Spyder, you're running a python script. To be able to get any output on the console you need to print the variable or function output.
It is a good practice to always use print unless you're want to see the output of a particular function call like head(), tail() etc
Akshay :
Thanks for your answer. Regarding " It is a good practice to always use print unless you're want to see the output of a particular function call like head(), tail() etc "
How do you get the output of this tickerDf.tail() in Spyder since you need to use print aswell to achieve this.
Hello Andreas,
That's right. So, in general, irrespective of the environment - IDE or shell it's good to print than rely on the last cell for printing.
Thanks.