Create a copy of a Pandas Dataframe with selected columns; write out to csv

PHOTO EMBED

Mon Mar 28 2022 21:54:30 GMT+0000 (UTC)

Saved by @ktyle #python #pandas

df2 = df1.filter(['Col 1', 'Col 2'], axis=1)
df2.write_csv('output.csv', index=False) # do not create a separate column index
content_copyCOPY