PyCharm Pro Scientific Mode

NB! Scientific mode is only available in the Pro version of PyCharm.

Started wondering how to execute Jupyter style of cell codes in PyCharm and found out you can make executable cells in PyCharm by enabling Scientific mode.

You can enable Scientific Mode from View –> Scientific Mode.

Cell model enables code execution by cell so you can run python code in order and small portions. For example importing .csv dataset and teaching dataset to machine learning mode in small portions.. Instead of every time you execute your whole code starting from scratch and waiting to import .csv file and teaching model again. Portions of code can be executed from a small green arrow or CTRL+ENTER.

New executable cells can be created in .ipynb and .py files with “#%%” that adds automatic cell reference and “# In[1]:” that manually adds cell reference. Numbered cells just reference previous cells with lower numbers. Green arrow executes codes in order inside Python console as shown in image below.

Jupyter notebook support

If you want to get more features like cell debug mode or Jupyter shortcuts for executing and creating new cells, you can install Jupyter package for PyCharm and run Jupyter server or Docker container and start using .ipynb files.

Jupyter notebook mode is enabled automatically while using .ipynb file and has a different console with visualizations enabled.

Some example code in project Github: https://github.com/Dunttus/AI-Project/blob/master/testing/ssh_login_tests/train_ssh_events.py

Sources

What is “# In[num]:”: https://stackoverflow.com/questions/48737788/what-does-innum-mean-in-jupyter-notebooks
PyCharm scientific mode: https://youtu.be/46RjXawJQgg

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s