今天看了本书,做数据集需要判断数据是否存在异常值。好像是用箱型图做的但是我不清楚具体的原理。附上代码:
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
train_data='zhengqi_train.txt'
test_data='zhengqi_test.txt'
train=pd.read_csv(train_data,sep='\t',encoding='utf-8')
for i in range(38):
plt.figure(figsize=(12,12))
sns.boxplot(train['V'+str(i)],orient='v')
plt.savefig('1/'+str(i)+'.jpg')#保存图片
最终结果展示:
标签:画箱,plt,python,data,train,pd,import,txt,异常 From: https://www.cnblogs.com/hahaah/p/16955807.html