Relative Content

Tag Archive for pythonpython-3.xpandasdataframe

Append new row if value doesnt exist by grouping columns

I have this dataset
| year | month | account | value |
| —- | —– | ——- | —— |
| 2023 | 1 | 1234 | 1 |
| 2023 | 1 | 9372 | 3 |
| 2023 | 2 | 1234 | 2 |
| 2023 | 2 | 8735 | 2 |
| 2024 | 1 | 8735 | 9 |
| 2024 | 1 | 0000 | 6 |