I have the following problem: I have a dataframe like this one:
col1 col2 col3
0 2 5 4
1 4 3 5
2 6 2 7
Now I have an array for example a = [5,5,5] and i want to insert this array in col3 but only in specific rows (let's say 0 and 2) and obtain something like that:
col1 col2 col3
0 2 5 [5,5,5]
1 4 3 5
2 6 2 [5,5,5]
The problem is that when I try to do:
zip_df.at[[0,2],'col3'] = a
I receive the following error ValueError: Must have equal len keys and value when setting with an ndarray
. How can I solve this problem?