I have a pandas dataframe like this.
Time Source Level County Town
0 2021-12-01 10:01:41.443 NaN NaN NaN NaN
1 NaN Test 3 C1 C1-T1
2 NaN Test 5- C2 C2-T0
3 NaN Test 5- C2 C2-T1
4 2021-12-01 10:01:46.452 NaN NaN NaN NaN
I want to append Town value, which is based on row have the same Source, Level and County value.
I have tried isin, groupby, diff(but my value is str), but still not figure out.
Image below is what I want to get.
Time Source Level County Town
0 2021-12-01 10:01:41.443 NaN NaN NaN NaN
1 NaN Test 3 C1 C1-T0
2 NaN Test 5- C2 C2-T0, C2-T1
3 2021-12-01 10:01:46.452 NaN NaN NaN NaN
Really appreciate your help!