【发布时间】:2023-01-25 20:51:01
【问题描述】:
这是我的代码
fig, ax = plt.subplots(4,4, figsize=(15,15))
for i,col in enumerate(churn3_01):
row, col = divmod(i, 4)
sns.countplot(x=col, data=churn3, ax=ax[row,col], hue='Churn')
churn3 是我的主数据框,churn3_01 是churn3 列的子集,Churn 是我的churn3 列。我收到此错误:
'bool' object has no attribute 'all'
我想为我的新数据框 churn_01 中的所有列创建一个计数图
【问题讨论】:
-
你能包括一些可复制的玩具数据吗?你能说出哪一行准确地给出了错误吗?你能包括完整的错误跟踪吗?
-
请注意,您的变量
col有问题。你给它分配了两个不同的东西:一次在for i,col in enumerate(churn3_01),一次在row, col = divmod(i, 4)。您应该更改其中之一的名称。