Understanding Rows

Rows in VisiData are pretty straightforward. The most important things you need to know are how to select/unselect them, move them, and edit their cells.

Selecting and Unselecting Rows

Many VisiData commands — such as filtering — distinguish between selected and unselected rows. You can select and unselect rows in a few ways:

One row at a time

Keystroke(s) Action
s Select the current row
u Unselect the current row
t Toggle the current row between selected/unselected

For instance, pressing s while on the second row of the FAA dataset should have the following effect:

  File  Edit  View  Column  Row  Data  Plot  System  Help     | VisiData 3.0.2 | Alt+H for help men
 OPERATOR            ATYPE         INCIDENT_DATE      STATE  AIRPORT             PHASE_OF_FLT>
 BUSINESS            PA-28         05/22/15 00:00:00  FL     VERO BEACH MUNICIP… APPROACH     BUSINESS           │ BE-1900      │ 06/18/15 00:00:00 │ AK    │ KENAI MUNICIPAL AR…│ APPROACH     │
 BUSINESS           │ PA-46 MALIBU │ 09/20/15 00:00:00 │ TX    │ DAVID WAYNE HOOKS …│              │
 DELTA AIR LINES     B-717-200     11/07/15 00:00:00  MO     LAMBERT-ST LOUIS I… APPROACH      BUSINESS            BE-90 KING    12/17/15 00:00:00  FL     POMPANO BEACH AIRP… LANDING ROLL  DELTA AIR LINES     B-757         07/17/15 00:00:00  VI     HENRY E ROHLSEN AR…               DELTA AIR LINES     B-717-200     08/02/15 00:00:00  TX     SAN ANTONIO INTL    APPROACH      BUSINESS            C-414         08/03/15 00:00:00  TX     LONE STAR EXECUTIV… DEPARTURE     ALLEGIANT AIR       MD-80         09/02/15 00:00:00  FL     TAMPA INTL          APPROACH      TRANS STATES AIRLI… EMB-145       09/07/15 00:00:00  MO     LAMBERT-ST LOUIS I… APPROACH      BUSINESS            C-172         11/28/15 00:00:00  FL     OPA-LOCKA EXECUTIV… APPROACH      GOVERNMENT          EC120         12/08/15 00:00:00  CA     NORMAN Y. MINETA S…               AMERICAN AIRLINES   A-321         05/06/15 00:00:00  FL     FORT LAUDERDALE/HO… APPROACH      EXPRESSJET AIRLINES CRJ100/200    05/06/15 00:00:00  AR     FORT SMITH REGIONA… CLIMB         MESA AIRLINES       CRJ900        05/08/15 00:00:00  AR     BILL AND  HILLARY … LANDING ROLL  BUSINESS            HELICOPTER    05/06/15 00:00:00         UNKNOWN             En Route      DELTA AIR LINES     A-320         05/07/15 00:00:00  CA     METRO OAKLAND INTL                DELTA AIR LINES     A-320         05/08/15 00:00:00  UT     SALT LAKE CITY INTL               LUFTHANSA           A-380         05/10/15 00:00:00  TX     GEORGE BUSH INTERC… CLIMB         BUSINESS            C-172         05/08/15 00:00:00  FL     ORLANDO SANFORD IN… APPROACH      SPIRIT AIRLINES     A-319         05/10/15 00:00:00  IL     CHICAGO O'HARE INT… CLIMB        1› faa-wildlife-strikes|                                        s   select-row      73448 rows  •1 

VisiData has highlighted that row and indicated the number of selected rows (the •1 in the bottom-right corner).

All rows at the same time

Keystroke(s) Action
gs Select all rows
gu Unselect all rows
gt Toggle all rows between selected/unselected

By matching patterns

Keystroke(s) Action
| + term Select all rows where term matches the current column
\ + term Unselect all rows where term matches the current column
g| + term Select all rows where term matches any column
g\ + term Unselect all rows where term matches any column
, Select all rows where the current column matches this row’s value for that column
g, Select all rows matching the current row (for all non-hidden columns)

For instance, if you take the following steps:

  • Navigate to the STATE column
  • Press |
  • Type TX
  • Press Enter

… you should see this:

  File  Edit  View  Column  Row  Data  Plot  System  Help     | VisiData 3.0.2 | Alt+H for help men
 OPERATOR            ATYPE         INCIDENT_DATE      STATE  AIRPORT             PHASE_OF_FLT>
 BUSINESS           │ PA-28        │ 05/22/15 00:00:00 │ FL    │ VERO BEACH MUNICIP…│ APPROACH     │
 BUSINESS            BE-1900       06/18/15 00:00:00  AK     KENAI MUNICIPAL AR… APPROACH     BUSINESS           │ PA-46 MALIBU │ 09/20/15 00:00:00 │ TX    │ DAVID WAYNE HOOKS …│               DELTA AIR LINES     B-717-200     11/07/15 00:00:00  MO     LAMBERT-ST LOUIS I… APPROACH      BUSINESS            BE-90 KING    12/17/15 00:00:00  FL     POMPANO BEACH AIRP… LANDING ROLL  DELTA AIR LINES     B-757         07/17/15 00:00:00  VI     HENRY E ROHLSEN AR…              DELTA AIR LINES    │ B-717-200    │ 08/02/15 00:00:00 │ TX    │ SAN ANTONIO INTL   │ APPROACH     │
BUSINESS           │ C-414        │ 08/03/15 00:00:00 │ TX    │ LONE STAR EXECUTIV…│ DEPARTURE    │
 ALLEGIANT AIR       MD-80         09/02/15 00:00:00  FL     TAMPA INTL          APPROACH      TRANS STATES AIRLI… EMB-145       09/07/15 00:00:00  MO     LAMBERT-ST LOUIS I… APPROACH      BUSINESS            C-172         11/28/15 00:00:00  FL     OPA-LOCKA EXECUTIV… APPROACH      GOVERNMENT          EC120         12/08/15 00:00:00  CA     NORMAN Y. MINETA S…               AMERICAN AIRLINES   A-321         05/06/15 00:00:00  FL     FORT LAUDERDALE/HO… APPROACH      EXPRESSJET AIRLINES CRJ100/200    05/06/15 00:00:00  AR     FORT SMITH REGIONA… CLIMB         MESA AIRLINES       CRJ900        05/08/15 00:00:00  AR     BILL AND  HILLARY … LANDING ROLL  BUSINESS            HELICOPTER    05/06/15 00:00:00         UNKNOWN             En Route      DELTA AIR LINES     A-320         05/07/15 00:00:00 ┌─────────────────────────────| statuses |─┐ DELTA AIR LINES     A-320         05/08/15 00:00:00 │ search wrapped                           LUFTHANSA          │ A-380        │ 05/10/15 00:00:00 │ 7309 matches for /TX/                     BUSINESS            C-172         05/08/15 00:00:00 │ selected 7309 rows                        SPIRIT AIRLINES     A-319         05/10/15 00:00:00 └──────────────────────────────────────────┘1› faa-wildlife-strikes|                               |   select-col-regex      73448 rows  •7309 

Via expressions

In VisiData, you can select rows by evaluating a given Python expression for every row in your dataset.

Tip

If you’re unfamiliar with Python, no worries. You can find an overview of simple and handy expressions here.

These expressions can reference any column in your dataset (so long as the column name contains only letters, underscores, and numbers, and doesn’t start with a number; in the next chapter, you’ll learn how to rename columns). The two keystrokes for this are z| and z\:

Keystroke(s) Action
z| + expr Select all rows where expr evaluates to True
z\ + expr Unselect all rows where expr evaluates to True

For instance, if you take the following steps:

  • Type gu to unselect all rows
  • Type z|
  • Type OPERATOR == "BUSINESS" and STATE == "FL"
  • Press Enter

… you should see this:

  File  Edit  View  Column  Row  Data  Plot  System  Help     | VisiData 3.0.2 | Alt+H for help men
 OPERATOR            ATYPE         INCIDENT_DATE      STATE  AIRPORT             PHASE_OF_FLT>
BUSINESS           │ PA-28        │ 05/22/15 00:00:00 │ FL    │ VERO BEACH MUNICIP…│ APPROACH     │
 BUSINESS            BE-1900       06/18/15 00:00:00  AK     KENAI MUNICIPAL AR… APPROACH      BUSINESS            PA-46 MALIBU  09/20/15 00:00:00  TX     DAVID WAYNE HOOKS …               DELTA AIR LINES     B-717-200     11/07/15 00:00:00  MO     LAMBERT-ST LOUIS I… APPROACH     BUSINESS           │ BE-90 KING   │ 12/17/15 00:00:00 │ FL    │ POMPANO BEACH AIRP…│ LANDING ROLL │
 DELTA AIR LINES     B-757         07/17/15 00:00:00  VI     HENRY E ROHLSEN AR…               DELTA AIR LINES     B-717-200     08/02/15 00:00:00  TX     SAN ANTONIO INTL    APPROACH      BUSINESS            C-414         08/03/15 00:00:00  TX     LONE STAR EXECUTIV… DEPARTURE     ALLEGIANT AIR       MD-80         09/02/15 00:00:00  FL     TAMPA INTL          APPROACH      TRANS STATES AIRLI… EMB-145       09/07/15 00:00:00  MO     LAMBERT-ST LOUIS I… APPROACH     BUSINESS           │ C-172        │ 11/28/15 00:00:00 │ FL    │ OPA-LOCKA EXECUTIV…│ APPROACH     │
 GOVERNMENT          EC120         12/08/15 00:00:00  CA     NORMAN Y. MINETA S…               AMERICAN AIRLINES   A-321         05/06/15 00:00:00  FL     FORT LAUDERDALE/HO… APPROACH      EXPRESSJET AIRLINES CRJ100/200    05/06/15 00:00:00  AR     FORT SMITH REGIONA… CLIMB         MESA AIRLINES       CRJ900        05/08/15 00:00:00  AR     BILL AND  HILLARY … LANDING ROLL  BUSINESS            HELICOPTER    05/06/15 00:00:00         UNKNOWN             En Route      DELTA AIR LINES     A-320         05/07/15 00:00:00  CA     METRO OAKLAND INTL                DELTA AIR LINES     A-320         05/08/15 00:00:00  UT     SALT LAKE CITY INTL               LUFTHANSA           A-380         05/10/15 00:00:00 ┌─────────────────────────────| statuses |─┐BUSINESS           │ C-172        │ 05/08/15 00:00:00 │ selected 625 rows                         SPIRIT AIRLINES     A-319         05/10/15 00:00:00 └──────────────────────────────────────────┘1› faa-wildlife-strikes|                                    z|   select-expr      73448 rows  •625 

Tip

Likewise, you can search via expressions using z/ (search forward) and z? (search backward).

Moving Rows

You can move the position of row up or down using the following commands:

Keystroke(s) Action
Shift-K Move row up one spot
Shift-J Move row down one spot

Editing Row Cells

Even if you don’t want to edit your raw data in VisiData, knowing how to edit cells will still come in handy, since virtually everything — including settings — in VisiData is represented as columns and rows.

Here are the most basic commands:

Keystroke(s) Action
e Begin editing current cell
Enter Finish editing
Control-c Cancel editing
Control-a Move to beginning of line
Control-e Move to end of line
Control-k Clear contents from cursor’s position to end of line

Other keys — such as Delete, standard characters, and the arrow keys — work as expected. You can find a handful of additional special commands in VisiData’s quick reference.