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

▼ Show 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.

Python
Learn More with Madanswer
...