A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| Key/Command | Description |
|---|---|
| Tab | Auto-complete files and folder names |
| Ctrl + A | Go to the beginning of the line you are currently typing on |
| Ctrl + E | Go to the end of the line you are currently typing on |
| Ctrl + U | Clear the line before the cursor |
| Ctrl + K | Clear the line after the cursor |
| Ctrl + W | Delete the word before the cursor |
| Ctrl + T | Swap the last two characters before the cursor |
A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| import sklearn.datasets | |
| import sklearn.cross_validation as cv | |
| from sklearn import linear_model | |
| dataset = sklearn.datasets.fetch_california_housing() | |
| X = dataset['data'] | |
| y = dataset['target'] |
| [alias] | |
| ## | |
| # One letter alias for our most frequent commands. | |
| # | |
| # Guidelines: these aliases do not use options, because we want | |
| # these aliases to be easy to compose and use in many ways. | |
| ## | |
| a = add |