Can someone please help. No matter what I do I always get some kind of length mismatch error when trying to set multiple columns.
These 2 lines work:
df.loc[(condition), ['column1', 'column2']] = 10, 20
df.loc[(condition), ['column1', 'column2']] = df['column3'] + 10
This gives error Must have equal len keys and value when setting with an ndarray
df.loc[(condition), ['column1', 'column2']] = df['column3'] + 10, df['column3'] - 10
Doesn't make sense to me because len(column1) = len(column2)
and len(df['column3'] + 10) = len(df['column3'] - 10)