I have a pandas dataframe. I want to fill some of the cells with numpy array but I get the following ValueError.
I wil not fill with zero array in real life. This is the simplified example code to replicate the error
ValueError: could not broadcast input array from shape (10,) into shape (1,)
import pandas as pd
import numpy as np
df = pd.DataFrame(columns=['name1','name2','array1','array2' ])
df = df.append({'name1': 'aaaa','name2': 'bbbb','array1':np.nan,'array2': np.nan}, ignore_index=True)
df = df.append({'name1': 'cccc','name2': 'dddd','array1':np.nan,'array2': np.nan}, ignore_index=True)
df.loc[((df['name1']=='aaaa') & (df['name2']=='bbbb')),'array1']=np.zeros((10,1))
print(df)