I do not still grok the right tool for what I need to do in pandas. It probably needs groupby(), but I was not able to locate the pythonic way (or any other) in the docs or on the web yet.
I have a table with data of a similar structure (30-50 columns):
ID name Town s1 s2 s3 s4
21 Joe Bonn rd fd NaN aa
21 Joe Bonn NaN hg kk NaN
22 Ann Oslo jg hg zt uz
29 Mya Rome rd fd NaN aa
I would like to combine rows with the same ID (that would be the index), combining the values in the rows without duplication, forming kind of a union of the string values.
So the result would be:
21 Joe Bonn rd fd,hg kk aa
22 Ann Oslo jg hg zt uz
29 Mya Rome rd fd NaN aa
df.groupby(df.index).sum() was a guess, but it just gives one NaN next to each index.