# Removing a Column from a CSV File with Python Pandas As part of another project ([[Speed of Pushing SQS Messages]]) another team presented me with a large-ish CSV file (714,285 rows with 8 columns). I actually need only one column in the data file I'm going to process. I had considered using the built-in Python `csv` module. However, I also have Pandas installed in my local system. Using Pandas, I can read in the 50mb file and write out the 12mb I care about super fast and with very little code/logic. The column I need to keep from the CSV spreadsheet it "Dashboard Key". ```python import pandas as pd input_file = "Dashboard_Keys_missing_in_S3_v4_many_columns.csv" output_file = "Dashboard_Keys_missing_in_S3_v4.csv" print(f"\nReading from {input_file}...") df = pd.read_csv(input_file, usecols=['Dashboard Key']) print("Sample records\n", df[:5]) print(f"Writing to {output_file}...") df.to_csv(output_file, index=False) ``` There is more code to print update info than actual "logic". 🤣 --- Created: 2022-12-09 08:39