Jun-29-2019, 03:06 PM
Hi there, my question is pretty much what the title says. I have a pandas dataframe with four columns, and I want to be able to get the unique values across pairs of columns. Here's my code:
This code works well for getting the number of unique values in one column, but I need to get the values across two columns. Since columns will have some of the same values, I can't just find them separately and add them together. I'd really appreciate any help, as I'm struggling to figure this out :)
Bonus question: How would I go about finding not the number of unique values, but the number of values that reoccur across both columns? :) Once I get this my work will be done :D
1 2 3 |
df_concat = pd.concat([df1, df2, df3, df4], axis = 1 ) len (df_concat[ 'K-mers A' ].unique().tolist()) |
Bonus question: How would I go about finding not the number of unique values, but the number of values that reoccur across both columns? :) Once I get this my work will be done :D