Last active
November 29, 2018 08:57
-
-
Save nithyadurai87/1756b2a5ec421fc3f36add04909cc517 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import pylab | |
import numpy as np | |
from scipy import stats | |
from scipy.stats import kurtosis | |
from scipy.stats import skew | |
import matplotlib._pylab_helpers | |
df = pd.read_csv('./14_input_data.csv') | |
# Finding outlier in data | |
for i in range(len(df.columns)): | |
pylab.figure() | |
pylab.boxplot(df[df.columns[i]]) | |
#pylab.violinplot(df[df.columns[i]]) | |
pylab.title(df[df.columns[i]].name) | |
list1=[] | |
for i in matplotlib._pylab_helpers.Gcf.get_all_fig_managers(): | |
list1.append(i.canvas.figure) | |
print (list1) | |
for i, j in enumerate(list1): | |
j.savefig(df[df.columns[i]].name) | |
# Removing outliers | |
z = np.abs(stats.zscore(df)) | |
print(z) | |
print(np.where(z > 3)) | |
print(z[53][9]) | |
df1 = df[(z < 3).all(axis=1)] | |
print (df.shape) | |
print (df1.shape) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment