pandas add value to excel column and save 1

pandas add value to excel column and save

import pandas as pd;
df = pd.read_excel("./YourExcel.xlsx");
YourDataInAList = [12.34,17.56,12.45];
df = df.append({"ColumnName": YourDataInAList}, ignore_index=True)
df.to_excel("./YourNewExcel.xlsx",index=False);

Here is what the above code is Doing:
1. Read the excel file
2. Create a list of data you want to add
3. Append the data to the dataframe
4. Write the dataframe to a new excel file

Similar Posts