Trying to fill a pandas dataframe with an array (let's say np.zeros(200)).
If we want to fill a pandas dataframe with a value:
for col in df.columns:
df[col].values[:] = 2
it works fine, but doing the same with:
for col in df.columns:
df[col].values[:] = np.zeros(200)
will not work.
I don't understand why the error is thrown (could not broadcast input array X into shape Y,) since I thought I was populating each value of the dataframe individually, therefore the shape wouldn't matter in my opinion.