how to remove duplicate columns dataframe 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()]