Get substring of column value #9889
Answered
by
gforsyth
vmsaipreeth
asked this question in
Q&A
-
Hi Team, let’s say I have a ibis data frame. In which, Column1 has [‘ABC’], [‘XY’, ‘ABCD’] values I want a new column to be created with following values: Column2 with ABC, XY-ABCD How simply can I do it with ibis data frames? I am using trino as my backend. |
Beta Was this translation helpful? Give feedback.
Answered by
gforsyth
Aug 22, 2024
Replies: 1 comment 1 reply
-
You can use [ins] In [7]: t
Out[7]:
┏━━━━━━━━━━━━━━━━━━━━━━┓
┃ a ┃
┡━━━━━━━━━━━━━━━━━━━━━━┩
│ array<string> │
├──────────────────────┤
│ ['xy', 'abcd'] │
│ ['abc'] │
└──────────────────────┘
[ins] In [8]: t.mutate(concat_col=t.a.join("-"))
Out[8]:
┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ a ┃ concat_col ┃
┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ array<string> │ string │
├──────────────────────┼────────────┤
│ ['xy', 'abcd'] │ xy-abcd │
│ ['abc'] │ abc │
└──────────────────────┴────────────┘ |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
cpcloud
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use
join
on an array of strings: