【发布时间】:2019-03-29 06:12:27
【问题描述】:
我有两个数据框 DF1 和 DF2。
DF1:
StartDate
1/1/2013
2/1/2013
11/1/2014
4/1/2014
5/1/2015
DF2:
EmploymentType EmpStatus EmpStartDate
Employee Active 11/5/2012
Employee Active 9/10/2012
Employee Active 10/15/2013
Employee Active 10/29/2013
Employee Terminated 10/29/2013
Contractor Terminated 11/20/2014
Contractor Active 11/20/2014
我想要 DF2 中的行数,其中就业类型 = 'Employee' 和 EmpStatus = 'Active' 和 EmpStartDate
输出:
Start Date Count
1/1/2013 2
2/1/2013 2
11/1/2014 4
4/1/2014 4
5/1/2015 4
如何在不合并两个数据框的情况下实现这一点?
我无法合并数据框,因为没有公用键,而且我需要根据条件计算行数,因此我无法在任何临时列上加入数据框,因为我需要避免交叉连接。
【问题讨论】: