-1

I have code in production that uses .loc to update multiple columns in one dataframe. Prior to the upgrade to Pandas 1.4.4, this code was working and now it's throwing an error. Any ideas on how to fix this?

df = pd.DataFrame([['yes','no','maybe']], columns=['A','B','C'])
df.loc[df['A']=='yes', ['B','C']] = ['test',df['A']]

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.

Keri
  • 17
  • 2

0 Answers0