csvpy
Execute Python code on CSV files
TLDR
Load a CSV file into a CSVKitReader object
Load a CSV file into a CSVKitDictReader object
SYNOPSIS
csvpy script.py data.csv
PARAMETERS
script.py
The Python script file containing the logic to process the CSV data.
data.csv
The input CSV file to be processed by the Python script.
DESCRIPTION
The `csvpy` command provides a versatile way to manipulate CSV (Comma Separated Values) files directly from the Linux command line.
It leverages Python scripting to perform various operations, such as filtering, reformatting, calculating aggregates, and more, all without requiring complex coding or specialized tools.
This command offers a streamlined workflow for processing CSV data, making it ideal for data analysis, reporting, and integration tasks. It is useful for manipulating tabular data using the full power of python and the convenience of command line.
SCRIPTING
The Python script passed to `csvpy` typically reads the CSV file using Python's `csv` module. Each row in the CSV is processed according to the script's logic, allowing for custom data transformations and operations. The modified or processed data can then be printed to standard output, redirected to a file or processed in another way.
EXAMPLE USAGE
Suppose you have a CSV file named data.csv, and you want to filter rows where the second column is greater than 100, and output to a new file. You could write a python script named filter.py to implement this filter, then call it as `csvpy filter.py data.csv > output.csv`