I'm using csvkit to manipulate csv files, but can't find how to do this:
- move one column before or after another column
- swap two columns but keep others unchanged
Does someone know how to do it?
You could use csvcut
csvcut -c column_c,column_a data.csv > new.csv
Or csvsql
csvsql --table=x --query "select column_c,column_a from x" data.csv
If you are used to sql queries the second might be easier for you.
According to the documentation you linked to, csvcut
can do the job. A disadvantage would be that you have to list all of the columns.
An alternative would be to use pandas
.