Skip to content

Instantly share code, notes, and snippets.

@AkdM
Created October 24, 2017 15:32
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/56d3d7eab2e452ceb545438bd82f61fc to your computer and use it in GitHub Desktop.
Save AkdM/56d3d7eab2e452ceb545438bd82f61fc to your computer and use it in GitHub Desktop.
Find columns on CSV with PANDAS
import pandas as pd
input_file = "input.csv"
output_file = "output_find.csv"
sep = ";"
df = pd.DataFrame.from_csv(input_file, sep=sep)
column1 = df['one'] > 123
column2 = df['two'] == "something"
df[column1 & column2].to_csv(output_file, sep=sep)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment