尝试绘制箱线图时为什么会出现错误?

时间:2020-04-14 04:26:10

标签: comparison boxplot

import numpy as np
import pandas as pd

from pylab import rcParams
%matplotlib inline
rcParams['figure.figsize']=5,4

#iris csv file from website:  https://gist.github.com/curran/a08a1080b88344b0c8a7
address: myFilePath
df= pd.read_csv(address, header=None, sep=',')
df.columns=['Sepal Length', 'Sepal Width', 'Petal Length', 'Petal Width', 'Species']

df.boxplot(return_type='dict') 
plt.plot()  

是否返回没有箱形图的空图?

x=df.iloc[:, 0:4].values
y=df.iloc[:, 4:].values
df.head(5)

Sepal_Width = x[:, 1]
iris_outliers = (Sepal_Width < 2.05)
df[iris_outliers]

TypeError:“ str”和“ float”的实例之间不支持“ <”

我尝试更改return_type ='axes'并发生相同的错误。我还更改了第二个示例的比较运算符,即使这些是标准操作,它也不起作用。

0 个答案:

没有答案