text_plain_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

data = pd.read_csv('/kaggle/input/refined-data/data_hard_refined.csv')
data_full = pd.read_csv('/kaggle/input/refined-data/data_filtered.csv')
objectColumns = list(data.dtypes[data.dtypes == np.object].index)
numericColumns = list(data.dtypes[data.dtypes != np.object].index)
objectColumns = list(data.dtypes[data.dtypes == np.object].index)
numericColumns = list(data.dtypes[data.dtypes != np.object].index)

data['Energy/Surface'] = data['SiteEnergyUse(kBtu)'] / data['PropertyGFATotal']
data['GHG/Surface'] = data['TotalGHGEmissions'] / data['PropertyGFATotal']
columns_to_boxplot = ['SiteEnergyUse(kBtu)', 'Energy/Surface', 'TotalGHGEmissions', 'GHG/Surface']
for column in columns_to_boxplot:
    n_bins = 12
    subset = data[column]
    subset.plot.box(vert=False)

for column in columns_to_boxplot:
    i = 0
    quartile_1 = data[column].quantile(0.25)
    quartile_3 = data[column].quantile(0.75)
    iqr = quartile_3 - quartile_1
    min_value = quartile_1 - 1.5 * iqr
    max_value = quartile_3 + 1.5 * iqr
    outliers = data[(data[column] > max_value) | (data[column] < min_value)]
    i += outliers.shape[0]
    print('colonnes {}, {} outliers détectés'.format(column, i))