Skip to content

Define name of a new created column #3489

Closed Answered by lmullany
BertrandBorel asked this question in Q&A
Discussion options

You must be logged in to vote

You may use alias:

from datatable import dt, f
DT = dt.Frame([[1, 2, 3], ["one", "two", "three"]])
DT.names = ['A','B']
DT[f.A >1,[f.A, f.B, dt.ifelse(f.B=="three",1,0).alias("C")]]

Output:

   |     A  B          C
   | int32  str32  int32
-- + -----  -----  -----
 0 |     2  two        0
 1 |     3  three      1

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@BertrandBorel
Comment options

Answer selected by BertrandBorel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants