Skip to content

Instantly share code, notes, and snippets.

@AkdM
Last active October 24, 2017 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkdM/f30559fd59a64a807f76911f16f28c16 to your computer and use it in GitHub Desktop.
Save AkdM/f30559fd59a64a807f76911f16f28c16 to your computer and use it in GitHub Desktop.
Remove Columns of a CSV with PANDAS
import pandas as pd
input_file = "input.csv"
output_file = "output.csv"
sep = ";"
columns = ["column1", "column2", "anotherone"]
df = pd.DataFrame.from_csv(input_file, sep=sep)
df.drop(df[columns], axis=1, inplace=True)
df.to_csv(output_file, sep=sep)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment