Asume that I have the following dataframe:
d = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=d)
I would like to extend col1
with array xtra
. However this errors out.
xtra = [3,4]
df['col1'].append(xtra)
How can I append xtra
to df.col1
, so that the final otuput would looks as so?
col1 col2
0 1 3
1 2 4
2 3 nan
3 4 nan