Visidata, handling CSVs
(You can enlarge the video above using the controls or open it in a new tab by clicking here)
Visidata is an excellent program for handling CSVs in a command line environment. Good for quick operations to explore the data, such as sorting, cleaning, analysis, and even basic plotting.
pip install visidata
Can also
visidata file.csv
Can be shortned to vd in some environments. You can read a file without a header from the stdin, for example
cat file.csv | vd --header=0
Operations
qexitsESCcancelsh,l,j,kfor movements (as you would in Vim)H,L,J,Kfor moving rows and columns in differnt directions[and]sorts-deletes columnddeletes row- Specifying type of column data
@date,#integer,$currency,%float !designates a column as a key, e.g. to plot data against.plots data. A key column should be speficied before, as well as the data type in the column(s) to be plottedSHIFT+FfrequencySHIFT+IstatisticsWpivot table+aggregatorstuselect, toggle, and unselect current row"start a new sheet with the selected row(s)z+displays result of aggregator over values in selectd rows for current column.|select rows matching a regex=evaluates a python expression, such as a conditiona>1000. The above operation can then be used to select matching rows
More on this VisiData cheatsheet, and 10 Ways to Use VisiData.
It is not just CSVs
Anything that can be opened with pandas can be opened with visidata. So this includes excel and html, and even URIs. This is powerful: the capability of pandas and the speed and versatility of the command line.
For example, you can search for your engine oil from this table
vd https://www.gmdexos.com/brands/dexos1/index.html
it may prompt you to install lxml if you dont have it
pip install lxml