In this post, we will see how to resolve Add increment column in VisiData
1.5.2, how can I add a new column which contains the row number?
This can be done in version
iI think, but that does not work in
1.5.2. When I try that it says:
no command for "i"
Maybe there’s a way of referencing the current row number in a expression?
Best Answer:This is more complicated than
i, but it will work!
zato create a new column. Then move your cursor to that column, and press
gz=. Type in range(n) where
nis the number of rows in your sheet (you can reference the number in the buttom right corner).
Another option is that you can try putting the code for
i(https://github.com/saulpw/visidata/blob/e2bbb7f60e069297f5da86f1cbe6faf3f606f72e/visidata/incr.py) in your installation of VisiData, and see if it ‘just’ works. VisiData’s code was intentionally made very modular to allow for easier plug and play possibilities. Just make sure to add it to your imports in the
__init__file as well: https://github.com/saulpw/visidata/blob/2cb5379f413dc9d7f0baae3e4f351bb7268efb32/visidata/__init__.py#L101
If you have better answer, please add a comment about this, thank you!