-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add --json option to csvstats with frequency details #1216
Labels
Comments
tacman
changed the title
add --json option to csvstats (or --format=json)
document csvstat with json
Oct 14, 2023
DOH! This is what I was looking for: csvstat data.csv --csv | csvjson | jq
[
{
"column_id": 1,
"column_name": "state",
"type": "Text",
"nulls": false,
"unique": 1,
"min": null,
"max": null,
"sum": null,
"mean": null,
"median": null,
"stdev": null,
"len": 2,
"freq": "NE"
},
{
"column_id": 2,
"column_name": "county",
"type": "Text", |
Actually, I'm going to reopen this, and ask that you consider adding a --json option that includes the frequency stats. csvstat data/subtitles_day.tsv
15. "movieKind"
Type of data: Text
Contains null values: False
Unique values: 2
Longest value: 5 characters
Most common values: tv (1443x)
movie (413x)
csvstat data/subtitles_day.tsv | csvjson | jq
{
"column_id": 15,
"column_name": "movieKind",
"type": "Text",
"nulls": false,
"unique": 2,
"min": null,
"max": null,
"sum": null,
"mean": null,
"median": null,
"stdev": null,
"len": 5,
"freq": "tv, movie"
},
{
So we lost the frequency data that exists in the text report. Yeah, it's a pain to add that in CSV, but it'd be natural in JSON, e.g. { "freq": { "tv": 1443, "movie": 413 }} |
tacman
changed the title
document csvstat with json
add --json option to csvstats with frequency details
Oct 14, 2023
Added
|
jpmckinney
added a commit
that referenced
this issue
Oct 17, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First, a big thanks for publishing csvkit! I only wish I had discovered it earlier.
I like the --csv option for csvstats, and would love to see a --json (or --format=json|csv|text) option. That would allow piping the results to another script, since importing JSON is much easier and faster than importing csv.
I know there are various scripts out there for csvtojson, but as I'm integrating this toolkit into our workflow I'd like to avoid having another tool to install.
Thanks for your consideration.
The text was updated successfully, but these errors were encountered: