Adding Columns
VisiData gives you several ways to add new columns. The most common: za for a blank column, = for a computed column, i for a row-number column. On this server, the common-config also adds Space rn Enter for a leftmost no row-number column.
Use za when you just need a new empty column (like a tag column). Use = when you want a computed value. Use i for built-in row numbering. Use Space rn Enter when you specifically want the column named no placed at the far left.
Add a Blank Column (za)
This is the primary way to add a new empty column — equivalent to inserting a column in Excel.
za # add one blank column
gza N # add N blank columns
Example — add a tag column for manual annotation:
za
# Enter column name: tag
All cells in the new column are empty. Edit them with e.
Example — add 3 blank columns at once:
gza 3
# Enter name prefix: extra
# Creates: extra_1, extra_2, extra_3
Add an Incremental Column (i, zi)
Add a column with sequential integers — useful for row numbering.
i # add new column with 1, 2, 3...
zi step # add new column with custom step
# Add a row ID
i
# Enter name: row_id
# Result: 1, 2, 3, 4, ...
# Add a column with step of 100
zi 100
# Enter name: batch
# Result: 100, 200, 300, ...
For filling existing columns with incremental values (gi, gzi), see Column Editing.
Custom Leftmost Row Number Column (Space rn Enter)
The common-config VisiData setup provides a custom command named rn:
Space rn Enter
Result:
no | existing_col_1 | existing_col_2 | ...
1 | ... | ... | ...
2 | ... | ... | ...
3 | ... | ... | ...
Use rn when you want a standard row-number column for export, auditing, screenshots, or talking through rows with someone else.
Key differences:
| Command | Result |
|---|---|
i | Adds an incremental column using VisiData's built-in command |
gi | Fills the current selected rows in the current column |
Space rn Enter | Adds a new first column named no and fills all rows from 1 to N |
Add a Derived Column (=)
Press = to add a new column computed from a Python expression. Column names become variables in the expression.
= # create a new derived column from Python expression
# 10% bonus on salary
=
# Enter: salary * 0.10
# Enter column name: bonus
# Full name from first + last
=
# Enter: first_name + ' ' + last_name
# Enter column name: full_name
# Classification by salary tier
=
# Enter: 'senior' if salary > 80000 else 'mid' if salary > 50000 else 'junior'
# Create a blank tag column (no expression needed)
=
# Enter: ""
# Enter column name: tag
Expression rules:
- Simple names:
salary,name,region - Names with spaces:
row['column name'] - System variable:
rownum(0-based row index)
Derived columns are ephemeral — they recompute every time the source data changes. Export the sheet to save them permanently.
For detailed Python expression patterns, see Formulas and Calculations.
Duplicate a Column (Y + gP)
Copy an existing column and paste it as a new column — no expression or regex needed.
Shift+C # open Columns Sheet
# Move to the column row you want to duplicate
Y # yank (copy) the column row
gP # paste it as a new column at the bottom
K # move it into position (up)
Then rename with ^ and edit values as needed. See Columns Sheet Operations for details.
Quick Comparison
| Need | Use | Key |
|---|---|---|
| Empty column for manual entry | za | za |
| Row numbers | i / zi | i |
Leftmost no row-number column | custom common-config command | Space rn Enter |
| Computed value | = | = |
| Copy of existing column | Y + gP | Columns Sheet |
Quick Reference
| Key | Action | Python? |
|---|---|---|
za | Add one blank column | No |
gza N | Add N blank columns | No |
i | Sequential integers 1, 2, 3... | No |
zi N | Sequential with custom step | No |
Space rn Enter | Add leftmost no sequence column | No |
= expr | Derived column from Python | Yes |
Y + gP | Duplicate column (Columns Sheet) | No |
Hands-On Practice
vd ~/github/practice-folder/visidata/01-loading/01-employees.csv
# 1. za → tag → creates a blank 'tag' column
# 2. Move to a tag cell → e → type "urgent" → Enter
# 3. i → row_id → creates a 1,2,3... row number column
# 4. Space rn Enter → creates a leftmost no column
# 5. = → salary * 1.10 → bonus → creates a computed bonus column
What's Next
- Column Editing — modify existing column values in-place
- Splitting and Extracting — split a column into multiple new columns