Python TypeError: cannot concatenate object of type ”; only Series and DataFrame objs are valid
I am getting the following error:
Pandas apply with “expand result” results in NaN columns when using loc but not [ ]
I am having some issues around setting new column values that are produced by a pandas apply
function. If you scroll to the bottom I’ve provided a MRE you should be able to copy-paste and run.
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 |