0

Create a dataframe from a dataframe by not extracting certain columns.

For example: In dataframe 1, we have 100 columns. We can create another dataframe taking 90 columns, and we can do it by:

new_df = pd.DataFrame(df, columns = []) # where columns = [] includes the 90 desired columns.

But is there a way to do the above not by writing 90 columns, can't we do columns != [] --> By passing the 10 columns which we don't need.

mallet
  • 2,454
  • 3
  • 37
  • 64
  • Hi! Please take a look at how to ask good questions https://stackoverflow.com/help/how-to-ask Currently this is hard to understand or answer – deiga Nov 17 '17 at 09:17
  • 1
    what about using `new_df = old_df.drop([10 columns to drop])`? – iparjono Nov 17 '17 at 09:20

0 Answers0