Reputation: 1149
I searched a lot but didn't quite find what I am looking for.
I have an array of numbers say [1, 2, 3].
and I have a dataframe:
attr1 attr2
A 10 13
B 11 14
C 12 15
I want to replace all values of attr1 with the values in the array so that my output is
attr1 attr2
A 1 13
B 2 14
C 3 15
I tried
df['attr1'] = df['attr1'] <- array
print df['attr1']
^ - that is setting everything to True or False
and df[['attr1']] <- array
throws an exception
ValueError: Wrong number of items passed 51, placement implies 1
Upvotes: 2
Views: 8522