Replies: 1 comment 13 replies
-
I really don't understand what you are trying to do. Can you also use code formatting please? |
Beta Was this translation helpful? Give feedback.
13 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a dictionary like this
dictionary={somekey:[v1,v2,v3,v4,v5,v6,v7]}
I want to assign values to a column based on the value of another column.
col1 col2
1 v2
1 v2
1 v2
1 v2
here 1 in col1 represents dictionary[somekey][1]
I have tried this.
df['col2']=df.func.where(df.col1=='1' #example,dictionary['somekey'][int(df.col1)],'')
this says the index of a dictionary cant be an expression which makes sense because columns are expressions, but still, need a way to do this.
Thanks in advance for any help.
Beta Was this translation helpful? Give feedback.
All reactions