This is the code:
import pandas as pd a = {"a":10,"b":20,"c":30} df1 = pd.DataFrame.from_dict(a,orient="index") print(df1)
Output:
0 a 10 b 20 c 30
Here I want to remove the ‘0’ on top of the column when writing this on excel.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
“0” in the dataframe is the column name. If you would like to export without column name you can set header as ‘false’.
df1.to_excel('file.xlsx', sheet_name="Summary", header=False)