Skip to content

Should addcol-window pad first list with None to indicate no rows above first row? #2279

@daviewales

Description

@daviewales

Small description

Given a column of values, I want to create a column containing the values of this column from the previous row.

test
A
B
C
D

I press w, and input 1 0 to create a column with 1 previous value, and 0 subsequent values:

image

I now create a new column with the previous values using =test_window[0]:
This yields exactly what I want, except in the first row.
Rather than the previous (NULL) value, I get the value of the current row:

image

Expected result

I expect the window list to always contain 2 values, and be padded with None when the previous value does not exist, such as for the first window record. This might look like the following:

image

Steps to reproduce with sample data and a .vd

test-window.zip

Additional context
Please include the version of VisiData and Python.

saul.pw/VisiData v3.0.1
Python 3.10.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions