Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Summary does not respect "column:operation" order #282

Closed
4 tasks done
tetedange13 opened this issue Jul 15, 2024 · 1 comment
Closed
4 tasks done

Summary does not respect "column:operation" order #282

tetedange13 opened this issue Jul 15, 2024 · 1 comment

Comments

@tetedange13
Copy link

Prerequisites

  • make sure you're are using the latest version by csvtk version
  • read the usage

Describe your issue

  • describe the problem

csvtk summary apply operations based on column order in file, rather than CLI-provided order

  • provide a reproducible example

$ csvtk csv2md test.csv

ReadNB Lane Density ClusterPF Reads ReadsPF
Read 1 1 231 89.08 49.93 44.48
Read 1 2 232 88.76 50.11 44.48
Read 1 3 228 89.19 49.23 43.91
Read 1 4 229 88.67 49.48 43.87
Read 3 1 231 89.08 49.93 44.48
Read 3 2 232 88.76 50.11 44.48
Read 3 3 228 89.19 49.23 43.91
Read 3 4 229 88.67 49.48 43.87

$ csvtk summary --groups Lane -f ReadsPF:sum -f Reads:sum -f ClusterPF:first -f Density:first test.csv |
csvtk headers

Lane
Density:sum
ClusterPF:sum
Reads:first
ReadsPF:first

Instead of expected (based on above command-line) :

Lane
Density:first
ClusterPF:first
Reads:sum
ReadsPF:sum


Thank you

I'm grateful to users who have greatly helped to report bugs and suggested new features.

I may respond to issues or fix bugs quickly, but I usually implement new features periodically (two or more weeks).

@shenwei356
Copy link
Owner

Fixed.

csvtk summary --groups Lane -f ReadsPF:sum -f Reads:sum -f ClusterPF:first -f Density:first test.csv  \
     | csvtk pretty 

Lane   ReadsPF:sum   Reads:sum   ClusterPF:first   Density:first
----   -----------   ---------   ---------------   -------------
1      88.96         99.86       89.08             231          
2      88.96         100.22      88.76             232          
3      87.82         98.46       89.19             228          
4      87.74         98.96       88.67             229 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants