我有一个数据科学相关的项目。我需要从我的 DataFrame 中删除某个名称。这是我尝试的:delete_row_1 = batsal[batsal["playerID"]=='giambja01'].indexremaining_players = batsal.drop(delete_row_1)为了测试这是否有效,我写了这个并得到了错误:'giambja01' in remaining_players['playerID'] False它似乎奏效了。然而,当我运行以下代码时,我得到了这个:remaining_players['playerID']10836 giambja0113287 heltoto012446 berkmla0111336 gonzalu018271 drewjd0125101 pujolal0117276 lawtoma0282 abreubo015395 catalfr0110852 giambje0122174 nevinph0120635 mientdo016275 coninje0111545 gracema0120173 mclemma0123005 ordonma0124596 pierrju0122418 nixontr015903 clarkto0230281 sweenmi0120688 millake0118086 loducpa0111810 grievbe013145 boonebr0129869 stewash0133183 whitero0232039 vidrojo01Name: playerID, dtype: object我附上了一个示例 DataFrame:batsal = pd.DataFrame({'playerID':['giambja01' , 'damonjo01' , 'saenzol01'],'Sex':['M','M','M']})请让我知道我做错了什么。
添加回答
举报
0/150
提交
取消