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

Join with some empty files #266

Open
4 tasks done
fgvieira opened this issue Feb 15, 2024 · 1 comment
Open
4 tasks done

Join with some empty files #266

fgvieira opened this issue Feb 15, 2024 · 1 comment

Comments

@fgvieira
Copy link

Prerequisites

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

Describe your issue

  • describe the problem
  • provide a reproducible example

Input files:

$ echo -e "f,c1\n1,2" > 1.csv
$ echo -e "f,c2\n3,4" > 2.csv
$ echo -e "f,c3" > 3.csv

Two first files works fine:

$ csvtk join -f f --na NA --outer-join 1.csv 2.csv 
f,c1,c2
1,2,NA
3,NA,4

But when including the empty file:

$ csvtk join -f f --na NA --outer-join 1.csv 2.csv 3.csv 
[WARN] no data found in file: 3.csv
f,c1,c2
1,2,NA
3,NA,4

it does not show!
Any way that it shoes up, but just all NAs? For example:

f,c1,c2,c3
1,2,NA,NA
3,NA,4,NA
@shenwei356
Copy link
Owner

Sorry, it's not easy to fix this in a short time. I'm busy recently.

Here's a workaround solution -- creating columns that are missed.

$ csvtk join -f f --na NA --outer-join 1.csv 2.csv 3.csv \
    | csvtk mutate2 -n c3 -e '"NA"'
[WARN] no data found in file: 3.csv
f,c1,c2,c3
1,2,NA,NA
3,NA,4,NA

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

No branches or pull requests

2 participants