Here is my code where I'm trying to add/append new values to the third column:
file = 'excel_name.xlsx'
df = pd.read_excel(file, engine='openpyxl')
print(df)
df.insert(3, 'sub', [1, 7, 4, 1])
print('test', df)
the output of print(df):
name ... sub
0 test1 ... NaN
1 test2 ... NaN
2 test3 ... NaN
3 test4 ... NaN
What I want to do:
name ... sub
0 test1 ... 1
1 test2 ... 7
2 test3 ... 4
3 test4 ... 1