[PYTHON] Formatting with autopep8 on Jupyter notebook

Ciao ... †

Today, I received a book called IPython Data Science Cookbook-Recipes for Interactive Computing and Visualization, so read it right away. (I'm still reading).

IPython has a mechanism called the magic command that makes it easy to perform operations that are frequently performed on cells and rows. Some are included by default, but you can customize it by creating your own magic command.

About 60% of my work is done with Jupyter notebook, so I was happy if I could solve it in Jupyter when the code became dirty. So I wrote a format for PEP8 coding style with autopep8 from Jupyter notebook!

I put it in the directory here. https://github.com/ikegami-yukino/misc/tree/master/misc/autopep8magic

Click here for usage and execution examples https://github.com/ikegami-yukino/misc/blob/master/misc/autopep8magic/README.ipynb

After inserting autopep8 with pip etc., just insert it with $ sh install.sh and %% autopep8 in Jupyter notebook!

スクリーンショット 2016-03-19 0.04.57.png Baban! ʻA = 1 + 1 becomes ʻa = 1 + 1.

It's a pity that I feel like copying the output result (I really want to do it in-place processing), but I hope this will make my work a little better.

Recommended Posts

Formatting with autopep8 on Jupyter notebook
Try SVM with scikit-learn on Jupyter Notebook
Enable Jupyter Notebook with conda on remote server
Using Graphviz with Jupyter Notebook
Use pip with Jupyter Notebook
High charts on Jupyter notebook
View PDF on Jupyter Notebook
Use Cython with Jupyter Notebook
Play with Jupyter Notebook (IPython Notebook)
Run Jupyter Notebook on windows
Monitor the training model with TensorBord on Jupyter Notebook
EC2 provisioning with Vagrant + Jupyter (IPython Notebook) on Docker
Visualize decision trees with jupyter notebook
Make a sound with Jupyter notebook
Run azure ML on jupyter notebook
Use markdown with jupyter notebook (with shortcut)
Add more kernels with Jupyter Notebook
Convenient analysis with Pandas + Jupyter notebook
Write charts in real time with Matplotlib on Jupyter notebook
Try running Jupyter Notebook on Mac
Try clustering with a mixed Gaussian model on a Jupyter Notebook
Use nb extensions with Anaconda's Jupyter notebook
Use apache Spark with jupyter notebook (IPython notebook)
I want to blog with Jupyter Notebook
Use Jupyter Lab and Jupyter Notebook with EC2
Make Jupyter Notebook a service on CentOS
Start jupyter notebook on GPU server (remote server)
Clone the github repository on jupyter notebook
How to use jupyter notebook with ABCI
GPU check of PC on jupyter notebook
Display histogram / scatter plot on Jupyter Notebook
Linking python and JavaScript with jupyter notebook
Build jupyter notebook on remote server (CentOS)
Use vim keybindings on Docker-launched Jupyter Notebook
[Jupyter Notebook memo] Display kanji with matplotlib
Run Jupyter notebook on a remote server
Rich cell output with Jupyter Notebook (IPython)
Jupyter Notebook memo
Introducing Jupyter Notebook
Use Jupyter Notebook with Visual Studio Code on Windows 10 + Python + Poetry + pyenv-win
Powerful Jupyter Notebook
Golang on jupyter
Settings when reading S3 files with pandas from Jupyter Notebook on AWS
Jupyter on AWS
Jupyter notebook password
Jupyter Notebook memo
Install matplotlib and display graph on Jupyter Notebook
How to debug with Jupyter or iPython Notebook
[Jupyter Notebook / Lab] 3 ways to debug on Jupyter [Pdb]
When Html cannot be output with Jupyter Notebook
Analytical environment construction with Docker (jupyter notebook + PostgreSQL)
Data analysis for improving POG 2 ~ Analysis with jupyter notebook ~
Play with custom image notebook on Kubeflow v0.71
Using MLflow with Databricks ① --Experimental tracking on notebook -
Verify NLC accuracy with Watson Studio's Jupyter Notebook
Try using conda virtual environment with Jupyter Notebook
[Pythonocc] I tried using CAD on jupyter notebook
Simply display a line graph on Jupyter Notebook
Fill the browser with the width of Jupyter Notebook
Graph drawing with jupyter (ipython notebook) + matplotlib + vagrant
Try Apache Spark on Jupyter Notebook (on local Docker