Buck Heroux 12/16/11
To install get the latest python egg distribution file from the downloads section of this project, or in the dist/ folder and use easy_install.
easy_install https://github.com/downloads/buckheroux/CSV-Analyzer/csv_analyzer-0.1.2-py2.6.egg
The CSV Analyzer is packaged with a CLI called csv. Use the csv tool to analyze files using an execution flag, specifying parameters, and masking results from the output.
The csv tool uses the following CLI structure
csv [--execution flag] file.csv [excution parameters] [--masks]
Here are some quick usage examples:
csv -f file.csv
csv -a file.csv units by date,id --unique
- All input is not case sensitive
- CLI is delimited by spaces ** If special charaters are needed for input surrond field with quotes ** "my long (field name)" ** If no headers exist, use column index as field name
Print column headers (fields) to ST_OUT
-
None
csv -f file.csv
Print the given fields to ST_OUT
-
List of fields selected for printing
-
If none, print full record
csv -l file.csv f1,f2,f3 csv -l file.csv
Print total row count after masks
-
None
csv -c file.csv
Print summation of given field.
Break down summation using the 'by' keyword
-
Field to be aggregated (must be numeric)
-
List of fields to break down the aggregation with
csv -a file.csv units csv -a file.csv units by date,id
Graph a field against another field.
Outputs a link to Google chart with the data.
Two or more data points must exist.
-
Field to be graphed on the y-axis as dependent variable (must be numeric)
-
Field to be graphed against on the x-axis as the independent variable (sorted by natural order)
csv -g file.csv units by date
Filter input to only account for matching records.
Filters are ANDed together
-
List of field=regex to be used as filter
csv -c file.csv --filter f1=rx1,f2="^[rx]+2$"
Mask non-unique records.
If field has many unique values, keep in mind that they are all kept in memory
-
List of fields to be used for uniqueness
csv -l file.csv id,name --unique id,external