So I have a panel df that looks like this:
| ID | year | value |
|---|---|---|
| 1 | 2002 | 8 |
| 1 | 2003 | 9 |
| 1 | 2004 | 10 |
| 2 | 2002 | 11 |
| 2 | 2003 | 11 |
| 2 | 2004 | 12 |
I want to set the value for every ID and for all years to the value in 2004. How do I do this?
The df should then look like this:
| ID | year | value |
|---|---|---|
| 1 | 2002 | 10 |
| 1 | 2003 | 10 |
| 1 | 2004 | 10 |
| 2 | 2002 | 12 |
| 2 | 2003 | 12 |
| 2 | 2004 | 12 |
Could not find anything online. So far I have tried to get the value for every ID for year 2004, created a new df from that and then merged it back in. Though, that is super slow.