DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

visidata Notes


Install

visidata is developed with Python and ncurse libraries. Install these libraries before install Python:

sudo apt install libncurses5 libncurses5-dev libncursesw5 libncursesw5-dev
asdf install python 3.8.1
asdf global python 3.8.1
pip install visidata
asdf reshim python
vd aaa.csv

Frequently Used Operations

Create & save a new sheet

Create a new sheet with 5 column: A5 Add a new row: a Edit the cell: e, 123 Edit the column name: ^ Add a new column: za Remove a row: d Save the sheet: Ctrl-s.

Sheet operation

S: list sheets q: quit sheet gq: quit visidata

Row operation

t: toggle current row selection gt: select/unselect all row

Sampling

R <5>: take <5> samples from origin sheet

Filter row

|: text match z|: Python expression match

": copy selected rows to a new sheet :

Column operation

!: Pin current column as key column

H/L: move current column one position to the left/right

-: hide the current column

C: column summary

F: histogram for the current column, add aggregator with +

Set type of column

#: integer %: float @: date ~: text

Data summary

I: summary of all columns

z+: max/min/mean/sum ... of current column

Groupby

  1. 标记汇总特征的数据类型:这里是实数,用 % 标记;
  2. 指定汇总方法:+ 后加上函数名称 max 并回车;
  3. (可选)标记分组特征的数据类型:由于字符串类型是默认类型,可以不标记;
  4. 分组汇总:按 F 键计算出新的分组汇总表;
  5. (可选)按一定的规则对汇总结果排序:这里对汇总特征 max_avg_mpg 进行从小到大排序。

Pivot Table



Published

May 6, 2020

Last Updated

May 22, 2020

Category

Tech

Tags

  • console 9
  • csv 4

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor