Skip to content

CLI: more flexible column selection #109

Description

@mikael-s

What would you like?
It would be nice to be able to select ranges of columns but also to be able to select columns whose names are integers, or using a regex.

Use case

Range of columns

Sometimes, the number columns in the data is unknown. In that case, it would be convenient to provide a range of columns, eg. 3.. to plot all the data from the fourth column till the last one. We could also imagine specifying several ranges (2..5,10..12), although cases where the number of columns is known could already be managed easily from the command line using seq (ie. --y $(seq -s, 2 5),$(seq -s , 10,12)).

Integer labels

When column names are integers (eg. years), we cannot select them by name using --y or --x.
For instance if a column is called 2026:

x,2026
5,1.4
7,2.1
15,3.2

We can't plot this data with kuva line --x x --y 2026:

error: Row 0: no column at index 2026

Maybe if the index doesn't exist, kuva could check for a column with this label, this may not solve cases where column names are small integers though. Another alternative would be to add an option to enforce using the column label instead of the index.

  • Regex*

Using column labels, it would also be nice to be able to select columns with regexes. Ideally we could even mix column selection with a regex, with a full label or even with an index.

x,y1,y2,sum_A,sum_B,sum_D,y3,y4
0,1,1,2,3,2,1,1 
1,0,2,1,2,1,0,1

One could plot columns y1, sum_A, sum_B and sum_D with kuva line --x x --y y1,sum.* or even kuva line --x --y y[123],sum_.* to also include y2 and y3.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions