Remove "Dr.", "Mr.", "Miss" and "Ms." from full_name by replacing them with an empty string "" in that order. Run the as

动态 未结 0 169
小小草
小小草 LV1 2023年9月23日 23:40 发表
# Replace "Dr." with empty string "" airlines['full_name'] = airlines['full_name'].str.replace("Dr.","") # Replace "Mr." with empty string "" airlines['full_name'] = airlines['full_name'].str.replace("Mr.","") # Replace "Miss" with empty string "" airlines['full_name'] = airlines['full_name'].str.replace("Miss","") # Replace "Ms." with empty string "" airlines['full_name'] = airlines['full_name'].str.replace("Ms.","") # Assert that full_name has no honorifics assert airlines['full_name'].str.contains('Ms.|Mr.|Miss|Dr.').any() == False
收藏(0)  分享
相关标签: 智能问答
问题没解决?让AI助手帮你作答 AI助手
0个回复
  • 消灭零回复