1
私は年齢欄からティーンエイジャーの生存率を見つけようと、「titanic.csv」https://www.kaggle.com/c/titanic/dataで働いているとパンダのマップを作成します。は二つの引数
under10 = (titanic['Age'] < 10).map({True:'under 10', False:'over 10'})
under10_survived_1 = titanic.groupby(under10)['Survived'].mean()
私は10代の範囲で同じことをしようとしたときにエラーが発生しました。
teenager = (titanic['Age'] < 20 and titanic['Age'] > 10).map({True:'Teenager', False:'Not Teenager'})
teenager = (titanic['Age'] < 20 & titanic['Age'] > 10).map({True:'Teenager', False:'Not Teenager'})
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
この問題を解決する方法についてのご意見はありますか?