# Abra Kadabra - Find Your Inner Jupyter Notebook Magician

- Speaker: [Malvina Matlis](/wiki/speakers/malvina-matlis.md)
- Event: [Reversim Summit 2021](/wiki/years/2021.md)
- Video: https://www.youtube.com/watch?v=eOxBcxiwAEE
- Transcript: [/transcripts/2021/37-eOxBcxiwAEE.md](/transcripts/2021/37-eOxBcxiwAEE.md)
- Language: Hebrew and English · Type: talk · Level: intro
- Topics: [Data Science](/wiki/topics/data-science.md), [Developer Experience](/wiki/topics/developer-experience.md), [Python](/wiki/topics/python.md), [Productivity](/wiki/topics/productivity.md)

> Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.

## Summary

The speaker demonstrates various magic commands in Jupyter Notebook to make data analysis tasks easier and more efficient. The talk covers practical techniques for managing environment variables, measuring execution time, and preventing data loss when kernels crash. Additionally, the speaker explains how to automatically reload external modules and create custom magic commands using decorators. Ultimately, the audience learns how to streamline their data science workflows and avoid redundant boilerplate code.

## Key points

- [0:11](https://www.youtube.com/watch?v=eOxBcxiwAEE&t=11s) The speaker introduces Jupyter Notebook magic commands as tools to make data analysis easier and cleaner.
- [1:14](https://www.youtube.com/watch?v=eOxBcxiwAEE&t=74s) Environment variables can be easily set and viewed directly inside the notebook using specific shortcut commands.
- [1:14](https://www.youtube.com/watch?v=eOxBcxiwAEE&t=74s) Execution time of lines or entire cells can be measured, and performance profiling can be generated.
- [2:14](https://www.youtube.com/watch?v=eOxBcxiwAEE&t=134s) Variables and data frames can be stored outside the kernel to prevent data loss when a kernel crashes.
- [3:14](https://www.youtube.com/watch?v=eOxBcxiwAEE&t=194s) The auto-reload extension can be used to automatically update external module changes without restarting the kernel.
- [3:14](https://www.youtube.com/watch?v=eOxBcxiwAEE&t=194s) Developers can create their own custom magic commands using decorators to automate repetitive tasks.
- [4:31](https://www.youtube.com/watch?v=eOxBcxiwAEE&t=271s) The built-in list magic command helps users recall all available magic commands in the system.

## Takeaways

- Use magic commands to quickly manage environment variables and measure code execution time inside notebooks.
- Implement variable persistence strategies to protect your work from unexpected kernel crashes.
- Leverage the auto-reload extension to test changes in external modules without constantly restarting your kernel.
- Write custom magic decorators to simplify repetitive operations like creating pivot tables.

## Questions this talk answers

- How can I prevent data loss in Jupyter Notebook when the kernel crashes?
- How do I measure the execution time of a specific cell or line in Python notebooks?
- Can I create my own custom magic commands in Jupyter, and how?

## Technologies

Python, Jupyter

## Tags

data science, developer productivity, jupyter notebook, python, tools
