run a .py file in jupyter notebook - jupyter-notebook

If I run the file as an ipynb file in jupyter notebook everything works fine. I export the file as a .py file and when I run it in jupyter notebook with "%run 02_02_data_verwerken_gas 100028" I suddenly get a strange output
The output in jupyter is correct but the output via de .py script is weird

Related

Unreadable Notebook: NotADirectoryError(20, 'The directory name is invalid')

I created a Jupyter notebook inside a virtualenv environment and worked fine in the first session. However, when I tried to open the notebook again, I got the error titled Error loading notebook saying Unreadable Notebook: 'Path' NotADirectoryError(20, 'The directory name is invalid'), where 'Path' is just the local path of the notebook.
I'm able to open the notebook using Colab and it works fine. Also, it is saved inside a folder that is synced by Google Drive.
How can I open my notebook with Jupyter again?
A print screen of the error:
Thanks
I have tried reinstalling Jupyter Notebook, but the error persists.

Run jupyter notebook from another jupyter notebook

This is the filepath of the ipynb notebook:
J:\AAA\BBB CCC\DDD \EEE FFF.ipynb
I did this: %run J:/AAA/BBB CCC/DDD /EEE FFF.ipynb
But got the following error:
Exception: File 'J:/AAA/BBB.py' not found.
How do I deal with files or folders that have spaces?

How do I force Jupyter Lab to revert a file

I have a Jupyter Notebook open in Jupyter Lab. I run black to reformat the code in the open Jupyter Notebook. If I try to save the file, Jupyter Lab raises
"notebook.ipynb" has changed on disk since the last time it was opened
or saved. Do you want to overwrite the file on disk with the version
open here, or load the version on disk (revert)?
How can I revert the Jupyter Notebook without try to save it?
I found the answer at File > Reload from Disk.

Problems about open .ipynb file incorrectly in PycharmI

I want use jupyter notebook in Pycharm,but when I open .ipynb file,it show as I show

Run R .ipynb script in terminal

I wrote some R scripts in ipython notebook followed by tutorial
Here is one example of R script in .ipynb
In python, we can simply run .ipynb script in the terminal by runipy
Is any way I could also run R .ipynb scripts in the terminal as well?
Eg: runipy_R R_script.ipynb in terminal

Resources