擅长:python、mysql、java
<pre><code># Convert each column dtype to str: x.astype(str)
# Null dtype became 'nan' so remove it: replace('nan', "")
# Concatenate each row entry: sum()
# Convert it to set to delete duplicate entries
# Convert it to list to concatenate with "," as a string
df_new = df.apply(lambda x: ",".join(list(set(((x.astype(str)).sum()).replace('nan', "")))), axis=1)
</code></pre>