79823424

Date: 2025-11-18 13:49:57
Score: 0.5
Natty:
Report link

Concerning the commentsprovided by @mozway, @rawson and @somedude the answer should be:

import pandas as pd
import numpy as np

dict = {'A': ['1','2','8','4',np.nan],
        'B': ['6','2','3','9','10']}
df = pd.DataFrame(dict)
df["C"] = df.apply(lambda x: ', '.join(x.dropna().unique()), axis=1)


print(df)

Result:

     A   B     C
0    1   6  1, 6
1    2   2     2
2    8   3  8, 3
3    4   9  4, 9
4  NaN  10    10
Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @mozway
  • User mentioned (0): @rawson
  • User mentioned (0): @somedude
Posted by: Bending Rodriguez