Unfortunately, scikit-learn Python library Class Imputer is now deprecated and the replacement does not include an axis parameter. Here’s a work-around.
Troubleshoot with `logging` instead of `print()`
Adding temporary print statements to troubleshoot Python code is quick and dirty. And messy. Incorporating logging into your code habit is a great alternative to relying on ad-hoc print statements that just need to get deleted later.
Save Google Colab notebook to HTML
Save a Google Colab notebook to another format, such as HTML or PDF.
Convert .py to .ipynb
Use p2j to convert Python source code to Jupyter Notebook.
Create iterator
iter(object)
Plot scatterplot matrix
pd.plotting.scatter_matrix(df, figsize=(15,15));
Verify that 2 DataFrames’ columns are the same
(df1.dtypes == df2.dtypes).all()
Convert a column’s datatype
df[‘column’] = df[‘column’].astype(float) # bool, float, int, str
Count duplicate rows
df.duplicated().sum()
Count rows with any null values
df.isnull().any(axis=1).sum()