How to emulate COALESCE? #802
Replies: 3 comments 11 replies
-
@tmtmtmtm , that's why I created the polars-powered With qsv joinp --left id data.csv id names.csv
id,name,name_right
1,Artur A. Mosiyan,
2,Eduard A. Aghabekyan,
3,Արամայիս Աղաբեկյան,Aramais E. Aghabekyan
4,Eleonora V. Avanesyan,
4 The 4 is the number of rows in the result sent to stderr. You can suppress that with You still get the uncoalesced columns though, but at least the suffix I'm still exploring polars, and I found it has a new coalesce function, but most of the examples are for python, not rust, so I'm still trying to figure it out... |
Beta Was this translation helpful? Give feedback.
-
@tmtmtmtm , shouldn't your join operation result in the in my |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I have a regular pattern where I want to left-join two CSVs, and then produce a column that is the value from file2 if that exists, otherwise the value from file1.
So, for example, with
data.csv
:and
names.csv
:I can do
qsv join --left id data.csv id names.csv
to get:
But now I want to select the equivalent of
id[0], name[1] // name[0]
to getI can't think of a way to do this with qsv at the minute (other than via
qsv py
or the like), so I usually drop tosqlite
for it:Am I overlooking a way to do this within
qsv
instead?Beta Was this translation helpful? Give feedback.
All reactions