我试图删除我的数据集的特定行,但我总是有同样的错误。我有几个候选人,我只想和两个一起工作。我尝试了“不在”状态,但是当我需要将其可视化时,它使用了所有候选人。我使用相同的公式删除列并且它有效!有任何想法吗?谢谢
poll = poll.drop(["Alexandria Ocasio-Cortez","Amy Klobuchar","Andrew Yang","Barack Obama","Bernard Sanders","Beto O'Rourke","Bill de Blasio","Charles E. Schumer","Elizabeth Warren","Cory A. Booker","Eric Swalwell","Howard Schultz","Hillary Rodham Clinton","John K. Delaney","Jay Robert Inslee","John Hickenlooper","Kamala D. Harris","Julián Castro","Justin Amash","Marianne Williamson","Kirsten E. Gillibrand","Megan Rapinoe","Michelle Obama","Michael F. Bennet","Michael Bloomberg","Mike Pence","Mike Gravel","Nancy Pelosi","Pete Buttigieg","Oprah Winfrey","Nimrata R. Haley","Sherrod Brown","Seth Moulton","Steve Bullock","Tulsi Gabbard","Tom Steyer","Tulsi Gabbard","Wayne Messam"])
我还尝试在最后添加axis = 1。
数据集: https ://projects.fivethirtyeight.com/polls-page/president_polls.csv