I want to create a new column with all the distinct values across the rows. Each value in a row is a string(not list).
This is how dataframe looks like:
+-----------------------------+-------------------------+---------------------------------------------+
| first | second | third |
+-----------------------------+-------------------------+---------------------------------------------+
|['able', 'shovel', 'door'] |['shovel raised'] |['shovel raised', 'raised', 'door', 'shovel']|
|['grade control'] |['grade'] |['grade'] |
|['light telling', 'love'] |['would love', 'closed'] |['closed', 'light'] |
+-----------------------------+-------------------------+---------------------------------------------+
This is how the dataframe should look like after creating a new column with distinct values.
df = pd.DataFrame({'first': "['able', 'shovel', 'door']" , 'second': "['shovel raised']", 'third': "['shovel raised', 'raised', 'door', 'shovel']", "Distinct_set": "['able', 'shovel', 'door', 'shovel raised', 'raised']" }, index = [0])
How can I do it?