import pandas as pd df = pd.read_csv("candidatelist.txt", sep = "\t") df.columns df["StatusCode"].value_counts() # filter out withdraw or did not qualify df = df[df["StatusCode"] != "WIT"] df = df[df["StatusCode"] != "DNQ"] df["StatusCode"].value_counts() # filter for orange county df["County"].value_counts() ora = df[df["County"] == "ORA"] ora = ora.dropna(subset="TrsNameFirst") ora["website"]= ora["TrsNameFirst"]+ora["TrsNameLast"]+".com" ora["website"] ora.to_csv("orange_county_Candidates.csv") ora.tail()