Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C csvkit
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 61
    • Issues 61
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • wireservice
  • csvkit
  • Issues
  • #245
Closed
Open
Issue created Dec 17, 2013 by Administrator@rootContributor

csvstack: handle reordered columns automatically

Created by: metasoarous

I would expect that csvstack would look at headers and stack data intelligently, but it does not. It simply cats the first file together with all but the first line of remaining files.

In particular, if column names occur in a different order, or if some file has columns that another does not, the results are not consistent with what one would expect.

For example:

csvlook a.csv =>
|----+----|
|  x | y  |
|----+----|
|  1 | 2  |
|  3 | 4  |
|  5 | 6  |
|----+----|


csvlook b.csv =>
|----+-------|
|  y | z     |
|----+-------|
|  8 | this  |
|  9 | that  |
|----+-------|

csvstack a.csv b.csv | csvlook =>
|----+-------|
|  x | y     |
|----+-------|
|  1 | 2     |
|  3 | 4     |
|  5 | 6     |
|  8 | this  |
|  9 | that  |
|----+-------|

I would expect the following:

csvstack a.csv b.csv | csvlook =>
|----+---+-------|
|  x | y | z     |
|----+---+-------|
|  1 | 2 |       |
|  3 | 4 |       |
|  5 | 6 |       |
|    | 8 | this  |
|    | 9 | that  |
|----|---+-------|
Assignee
Assign to
Time tracking