I have a pandas dataframe
0 1 2 3
0 173.0 147.0 161 162.0
1 NaN NaN 23 NaN
I just want to add value a column such as
3
0 161
1 23
2 181
But can't go with the approch of loc and iloc. Because the file can contain columns of any length and I will not know loc and iloc. Hence Just want to add value to a column. Thanks in advance.
I believe need setting with enlargement:
df.loc[len(df.index), 2] = 181
print (df)
0 1 2 3
0 173.0 147.0 161.0 162.0
1 NaN NaN 23.0 NaN
2 NaN NaN 181.0 NaN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With