let's say I have four columns with strings in each column (pandas df). If I want to compare if they are all the same, I came up with something like this:
df['same_FB'] = np.where( (df['FB_a'] == df['FB_b']) & (df['FB_a'] == df['FB_c']) & (df['FB_a'] == df['FB_d']), 1,0)
It works fine, but it doesn't look good and if I had to add a fifth or sixth column it get's even uglier. Is there another way to test if all columns are the same? Alternatively, I would be ok with counting the distinct values in these four columns.