awswrangler.catalog.drop_duplicated_columns

awswrangler.catalog.drop_duplicated_columns(df: pandas.core.frame.DataFrame) → pandas.core.frame.DataFrame

Drop all repeated columns (duplicated names).

Note

This transformation will run inplace and will make changes in the original DataFrame.

Note

It is different from Panda’s drop_duplicates() function which considers the column values. wr.catalog.drop_duplicated_columns() will deduplicate by column name.

Parameters

df (pandas.DataFrame) – Original Pandas DataFrame.

Returns

Pandas DataFrame without duplicated columns.

Return type

pandas.DataFrame

Examples

>>> import awswrangler as wr
>>> df = pd.DataFrame({"A": [1, 2], "B": [3, 4]})
>>> df.columns = ["A", "A"]
>>> wr.catalog.drop_duplicated_columns(df=df)
   A
0  1
1  2