Recently, I often use Jupyter Notebook for data analysis, so I have summarized how to use it. This article will be updated from time to time.
If you install it with Anaconda, the Jupyter Notebook itself will be ready to use. However, it is better to take the following measures for convenient use.
If you do nothing, Japanese characters will be garbled, so install the Japanese font and apply it to Jupyter Notebook. Please refer to the following article for details. [Python] Japaneseize matplotlib
The longer the note, the harder it is to find the part you want. So it's a good idea to install jupyter_contrib_nbextensions and enable the extension "Table of Contents (2)". Please refer to the following article for details. Make an oleore Python cheat sheet using the extension of Jupyter notebook
Only the ones that are used frequently are extracted.
--Cell Execution: Ctrl-Enter --Execute cell → Select the cell below: Shift-Enter --Execute cell → Insert cell below: Alt-Enter --Save: Ctrl-s
--Transition to command mode: Esc --Interruption of running code: Ctrl-C --Tab completion: Tab with variable name, method name, etc. entered halfway --Object introspection (see general information about objects and docstrings): Before or after variables? Execute cell with
--Transfer to edit mode: Enter --List of shortcut keys: h (in command mode) --Change cell to code: y --Change cell to markdown: m --Create heading with markdown: 1-6 --Add cell (above the selected cell): a --Add cell (below the selected cell): b --Cell copy: c --Cut cell: x --Paste cell (bottom): v --Paste cell (top): Shift-v --Delete cell (selected cell): dd --Find and Replace: f
This is a command unique to Jupyter Notebook.
--% magic: Show detailed description of all magic commands --% time instruction (method, etc.): Measurement of instruction execution time --% timeit instruction (method, etc.): Measurement of instruction execution time (multiple times) * Effective for measuring instructions with extremely short execution time --% debug: Start from the bottom of the traceback for the last exception --% run Python filename Command line argument (optional): Start Python program --% who,% who_ls,% whos type name, variable name, etc .: Returns a list of variables of that type defined in the namespace in use (% who is a list,% who_ls is a list,% whos is a list. Return in a formatted list) --% reset: Remove names including variables from namespaces --% matplotlib inline: Display Matplotlib inline
--display function: If you use this instead of the print function, you can display with ruled lines.
You can use it by installing RISE with
pip install rise.
--Wes McKinney (2018) "Introduction to Data Analysis with Python 2nd Edition -Data Processing with NumPy, pandas", O'Reilly Japan