+1 vote
in Python by
How to select columns in pandas and add them to a new dataframe? What if there are two columns with the same name?

1 Answer

0 votes
by

If df is dataframe in pandas df.columns gives the list of all columns. We can then form new columns by selecting columns.

If there are two columns with the same name then both columns get copied to the new dataframe.

Related questions

0 votes
asked Aug 14, 2021 in Python Pandas by SakshiSharma
0 votes
asked Feb 10, 2021 in Python by SakshiSharma
...