基于之前的EDA数据探索性分析,本篇博客把之前的函数实例化,数据和之前的相同
import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
class EDA:
# def __init__(self,file_path):
# self.file_path=file_path
#获得数据
def __init__(self,file_path):
self.file_type = file_path.split('.')[1]
if self.file_type=='txt':
self.df=pd.read_table(file_path)
elif self.file_type=='csv':
self.df=pd.read_csv(file_path)
elif self.file_type == 'xls' or self.file_type == 'xlsx':
self.df = pd.read_excel(file_path)
self.label_col=list(set(self.df.columns)-set(self.df.describe().columns))
self