But I encountered an issue while using this code.
cn = ['AgeUnder18', 'Age19to25', 'Age26to29']
sns.boxplot(x=cn, y='AveMonthSpend', data=df)
Error:
The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
CodePudding user response:
You need to convert the dataframe to
This supposes the original dataframe looks like:
Out[10]:
AgeUnder18 Age19to25 Age26to29
0 64.980248 64.673755 56.489776
1 59.858895 48.921889 62.877826
2 62.357871 51.599347 55.651448
3 47.206124 45.817266 52.893839
4 57.627501 51.820863 59.616511
5 61.999523 63.443241 45.919390
6 56.616062 48.353018 46.282314