python-3.x - How to delete rows in Dataframe that contain attribute values in Series
问题描述
I have a series of employee ID's and a dataframe that uses employee id's. I would like to delete all the rows from the dataframe that have corresponding employee id's in the Series
I have this code which provides the Series
resigned = employee_change['employee_id'][employee_change['type_of_termination'] == 'resignation']
I then have a dataframe called change_employee and would like to remove all rows of change_employee that has an employee_id in the series resigned
解决方案
change_employee = change_employee.loc[~change_employee['employee_id'].isin(resigned)]
推荐阅读
- node.js - 将节点应用部署到带有防火墙的 Google Cloud VM 中
- laravel - laravel s3 签名的 url 不适用于 pdf
- google-data-studio - 返回一个日期的首次购买次数
- c++ - 按词法顺序排列二维数组
- python - python中的冰雹程序
- python - 是否可以在日期时间模块中制作计数器?
- python - TypeError: 'Tk' object is not callable 为什么我会收到此错误消息
- angular - 指向组件的动态菜单链接
- c++ - C ++中的双重析构函数调用
- css - 文本元素不适合 div 父级 [Oxygen Builder / Wordpress]