drop one of duplicate columns pandas code example
Example 1: python - remove repeted columns in a df
df.loc[:,~df.T.duplicated(keep='first')]
Example 2: remove duplicate columns python dataframe
df = df.loc[:,~df.columns.duplicated()]
df.loc[:,~df.T.duplicated(keep='first')]
df = df.loc[:,~df.columns.duplicated()]