Reputation: 1933
As Jupyter Notebook integration is available in PyCharm professional, is there a GUI option to convert a .py to a .ipynb file? I tried to edit the file extension, e.g. from test.py to test.ipynb, but then I can't open the .ipynb file.
Upvotes: 6
Views: 7340
Reputation: 41
If all you want is just to run your code cell by cell directly on Pycharm's console, you don't need to convert it from .py to .ipynb.
Just activate View > Scientific Mode and add #%%
markers to separate the cells directly in your .py file. Now you can execute it by using the green arrows on the left side of your code.
Tested on Pycharm professional 2020.3.2
Upvotes: 4
Reputation: 23562
Simplest way I found without installing extra dependencies is:
Then you can add #%%
markers to separate the cells.
Upvotes: 3
Reputation: 64
Try using
pip install ipynb-py-convert
https://medium.com/@researchplex/the-easiest-way-to-convert-jupyter-ipynb-to-python-py-912e39f16917
Upvotes: 2