创建箱线图时的 Python 分类变量 NaN

问题描述 投票:0回答:0

我成功创建分类值后,它们的结果是 NaN。

我使用了这个命令:

df['Memory']= pd.cut(pd.to_numeric(df['RAM '], errors="coerce"), [0,4,8,12],
                     include_lowest=True, labels=['Basic', 'Intermediate', 'Advaced'])

运行后

df.head()
这是表格:

当我尝试对它们进行箱线图时:

sns.boxplot(x='Memory', y='Price', data=df['RAM '] = pd.to_numeric(df['RAM '], errors="coerce") ;  df['Memory']= pd.cut(df['RAM '], [0,4,8,12], include_lowest=True, ..)

我收到错误语法无效

有什么办法可以解决这个问题吗?

python dataset boxplot categorical-data
© www.soinside.com 2019 - 2024. All rights reserved.