Skip to content

Instantly share code, notes, and snippets.

@jurand71
Created July 3, 2022 05:16
Show Gist options
  • Save jurand71/d0288d6d4b7e7f3a7362134c68774135 to your computer and use it in GitHub Desktop.
Save jurand71/d0288d6d4b7e7f3a7362134c68774135 to your computer and use it in GitHub Desktop.
# Import libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Display all columns
pd.set_option('display.max_columns', None)
# Ignore warnings
import warnings
warnings.filterwarnings('ignore')
# Import Houseprice data from GitHub
df = pd.read_csv('https://github.com/jurand71/datasets/raw/master/HouseSalePriceCompetition/houseprice.csv')
# Determine numerical and positive variables and other than 'Id'
variables = []
for var in df.columns:
if var not in ["Id","SalePrice"] and df[var].dtypes != "O":
if np.sum(np.where(df[var] <= 0, 1, 0)) == 0:
variables.append(var)
# Explore the distribution of selected variables
df[variables].hist(figsize=(15,15))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment