Tech tip of the day for those who have to deal with CSV files
-
wrote on 27 Apr 2022, 20:50 last edited by Klaus
I discovered these life-changing utilities today:
https://csvkit.readthedocs.io/en/latest/Instead of going through the intense pain of importing tables into something like Excel, they allow you to just SQL-query your data on the command line instead.
For instance, if we have data about exam results in a CSV file and I want a histogram of the result distribution, I just do
> csvsql -I --table grades examresults.csv --query 'SELECT Grade,COUNT(*) AS Count FROM grades GROUP BY Grade' Grade,Count "1,0",3 "1,7",13 "2,0",24 "2,3",25 "2,7",42 "3,0",53 "3,3",53 "3,7",81 "4,0",32 "5,0",132 Ever tried something like that in Excel? It's a PITA.
I can't believe I've managed to live my life until this point without this tool.
-
wrote on 27 Apr 2022, 21:16 last edited by
That would come in handy if I could craft SQL queries off the top of my head like that.
-
wrote on 27 Apr 2022, 21:33 last edited by
-
wrote on 27 Apr 2022, 22:25 last edited by
@Horace said in Tech tip of the day for those who have to deal with CSV files:
That would come in handy if I could craft SQL queries off the top of my head like that.
Believe it or not, but mastering SQL is a tiny task compared to mastering Excel. Also, using SQL is already the advanced use case. Many of the tools work out-of-the-box without the need for SQL.
Their true power comes from their composability, thanks to the Unix philosophy. Ken Thompson and Dennis Ritchie should have been award the Nobel peace prize or something.
-
wrote on 27 Apr 2022, 23:17 last edited by
“csvsql” … nice, and it doesn’t look that hard to program too, amazing it’s not already more popular.
-
wrote on 29 Apr 2022, 12:50 last edited by
ISnt that a US pharmacy? LOL
-
ISnt that a US pharmacy? LOL
wrote on 29 Apr 2022, 12:51 last edited by@taiwan_girl said in Tech tip of the day for those who have to deal with CSV files:
ISnt that a US pharmacy? LOL
"CVS"
-
@taiwan_girl said in Tech tip of the day for those who have to deal with CSV files:
ISnt that a US pharmacy? LOL
"CVS"
wrote on 30 Apr 2022, 00:56 last edited by@George-K :woman-facepalming: