Jupyter Notebook vs PyCharm: Benefits for Data Science and ML Projects

3 minutes read

If you watch any video tutorials about Machine Learning and Python, you will see that most developers use Jupyter Notebook for ML projects, not IDE like PyCharm. Why? What are the benefits?

You see, Python is a multi-purpose programming language, not just for data science. With Python, you can create web projects, games, and other applications. And PyCharm is a general-purpose IDE for writing Python code for those multiple purposes.

Notice: in this article, I'm talking about free versions of both tools, for a fair comparison. So I'm talking about PyCharm Community Edition, specifically.

Jupyter Notebook, on the contrary, is focused on a data scientist's workflow, allowing to run different data transformations and visualizations right in the code cell instead of running the full .py script.


Three Reasons I See

In general, I would emphasize these benefits of Jupyter over PyCharm, specifically for ML projects:

1. Markdown notes inside. You can write Markdown comments inside the notebook. It is called a notebook for a reason, mimicking the behavior of a data scientist: you test a theory, and you write the notes before/after for yourself and other data scientists.

2. Execute individual cells. If you want to run some data transformation line in the middle of the script, Jupyter allows you to do it without touching any other part of the script. In PyCharm, you would need to run the entire script every time. Also, in Jupyter Notebook, you don't need to write print() if you want to show some value, just write the variable/method in the code and run the cell.

3. Share your notebooks. If you have a .ipnyb file of the notebook, you can send it to other people or upload it on GitHub, and others would be able to see the result of your script even if they don't have Python installed on their machine. It's very beneficial on websites like Kaggle, which has a lot of notebooks shared by thousands of Python developers. Some write long-form tutorials as a notebook, see this example.

See my own personal example of a notebook for this Linear Regression course:

See how natural it looks, with Markdown comments, code, and the results all in one?


My Favorite Jupyter Notebook Shortcuts

The full power of Jupyter is unlocked when you learn how to navigate and edit/run everything very quickly with just a keyboard, without using the mouse/trackpad.

So here, I will list my favorite keyboard shortcuts. I will mention the ones on Mac. Please look up the Windows alternatives that should be similar.

  • Shift + Enter: run a specific cell
  • A to create a cell above, B to create a cell below
  • M to change cell to Markdown type, Y to change the cell to Code type
  • DD to delete the current cell
  • Enter to edit cell, Esc to stop editing
  • Cmd + A + Cmd + Enter: re-run all the notebook

If you want to find more shortcuts, go to the menu Help -> Show Keyboard Shortcuts:


Anton Cherednichenko avatar
Anton Cherednichenko

You do know that PyCharm supports .ipynb format and can act exactly like Jupyter notebook, right ?

Povilas avatar

Yes, but not the Community Edition of PyCharm, which I used. Good point, I will add that notice to the article, thanks for the notice.