csv-query
Query CSV data with structured filter, sort, select, and aggregate operations.
Why install it
CSV handling shows up constantly in ops and analyst workflows. This tool gives agents a safe, predictable query surface without embedding ad hoc dataframe code into each app.
Inputs
path: path to a local CSV filecsv_text: raw CSV content passed directly to the toolselect: subset of columns to keep in the outputfilter: filter conditions such aseq,gt, orcontainssort: sort operations with column and optional directionlimit: maximum number of rows to returngroup_by: columns used to group rows before aggregationaggregations: aggregate calculations such ascount,sum,avg,min, andmax
Outputs
columns: output column namesrows: resulting rows after query operationsrow_count: number of rows returnedsummary: aggregate or grouping summary information
Local development
The source code for this tool can be found here
Test:
python -m unittest discover -s tests -p 'test_*.py'
Example invocation
python -u csv_query/__main__.py < input.json
With input.json containing:
{
"csv_text": "name,score\nA,2\nB,5",
"filter": [
{
"column": "score",
"op": "gt",
"value": "2"
}
]
}