I will give a simple dataframe as an example:
ID | Year | Company | Product |
---|---|---|---|
1 | 1984 | ACME | P1 |
2 | 1986 | ACME | P2 |
3 | 1951 | SMITH | P3 |
4 | 1982 | COLEMAN | P4 |
5 | 1987 | HILL | P5 |
6 | 1960 | TANNER | P6 |
If I wanted to get a count of all product years 1980 or later, reporting those companies before 1980 as 0, how would I do it?
If I filter on YEAR >= 1980 then try to get the counts from that, then I would likely get ACME:2, COLEMAN:1, HILL:1
What I would want though is ACME:2, COLEMAN:1, HILL:1, SMITH:0, TANNER:0