Skip to content

How to calculate a windowed rank function? #2280

Answered by midichef
daviewales asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, yes, you can do this with Visidata. It took me a while to remember how. I did it with your method: mark the start of the group. The two other key steps are:

  1. Get the row number, using i (addcol-incr).
  2. Let each row see the row number of the start of its group. Select all rows with gs, then f to fill nulls.

    The expression for first is w[0] != w[1] if len(w) == 2 else True.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@daviewales
Comment options

Answer selected by daviewales
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants