Re:XAN: A Modern CSV-Centric Data Manipulation Toolkit for t...
by account-5 on Sunday March 30, 2025 @10:01AM
(#43524282)
I find Nushell even better for these usecases:
$medias = open .\medias.csv
The above is the initial read and format into table.I'm currently on my phone so can't go through all the examples, but knowing both PS and nu, nu has the better syntax.
EDIT:
Get data and view in table:
let $medias = http get https://github.com/medialab/corpora/raw/master/polarisation/medias.csv
$medias
Get headers: $medias | columns
Get count of rows: $medias | length
Get flattened, slight more convoluted (caveat there might be a better way): $medias | each {print $in}
Search rows: $medias | where $it.outreach == 'internationale'
Select columns: $medias | select foundation_year name
Sort file: $medias | select foundation_year name | sort-by foundation_year
Dedup based on column: $medias | uniq-by mediacloud_ids
Computing frequency and histogram $medias | histogram edito
Re:XAN: A Modern CSV-Centric Data Manipulation Toolkit for t...
by SwamyM on Sunday March 30, 2025 @02:08PM
(#43526195)
Yes, I find PowerShell is criminally underrated for these type of tasks. Even though it's open source and cross-platform, the stigma from it's Windows-centric days is hard to overcome.
Translating the examples from the ReadMe, having read the file with:
Previewing the file in the terminal Reading a flattened representation of the first row Searching for rows Selecting some columns Sorting the file Deduplicating the file on some column Computing frequency tables It's probably orders of magnitude slower, and of course, plotting graphs and so on gets tricky. But for the simple type of analysis I typically do, it's fast enough, I don't need to learn an extra tool, and the auto-completion of column/property names is very convenient.