# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load

import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
from matplotlib import pyplot as plt

# Input data files are available in the read-only "../input/" directory
# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory

import os
for dirname, _, filenames in os.walk('/kaggle/input'):
    for filename in filenames:
        print(os.path.join(dirname, filename))

# You can write up to 5GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using "Save & Run All" 
# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session
import pandas as pd
creditcard = pd.read_csv("../input/creditcardfraud/creditcard.csv",index_col=0)
"""
# Exploratory Data Analysis
"""
creditcard.head()
# summarize the shape of the dataset
print(creditcard.shape)
creditcard.describe()
creditcard.info()
"""
## Target Distribution
"""
plt.hist(creditcard['Class'])
creditcard.Class.unique()
creditcard.Class.value_counts()
"""
# Selecting Highly Correlated Features
"""
cor = creditcard.corr()
#Correlation with output variable
cor_target = abs(cor["Class"])
#Selecting highly correlated features
relevant_features = cor_target[cor_target>0.2]
relevant_features
#Selecting highly correlated features
relevant_features = cor_target[cor_target>0.1]
relevant_features
df=relevant_features.to_frame()
df.head()
df1=cor[['V1','V3','V4','V7','V10','Class']]
df1.head()
import seaborn as sns
#Using Pearson Correlation
plt.figure(figsize=(12,10))
#cor = creditcard.corr()
sns.heatmap(df1, annot=True, cmap=plt.cm.Reds)
plt.show()
"""
## Finding Columns with NULL Values

As we see here, there are no null values in the dataset.
"""
creditcard.isnull().sum(axis=0)