【pandas】关于index

import pandas as pd
df = pd.read_excel(r'D:\test\classify_all_data_simplified_version.xlsx')
# index 从1开始
df = pd.DataFrame(df)
df.index += 1


import pandas as pd
# 导出不要index,to_excel 
df = pd.read_excel(r'D:\test\classify_all_data_simplified_version.xlsx')
df['doc_nbr']= df['doc_nbr']+'\t'
df.to_csv(r'D:\test\classify.csv',index = False,encoding = 'gbk')
df.to_excel(r'D:\test\classify.xlsx',index = False,encoding = 'gbk')

你可能感兴趣的:(pandas,pandas,python,数据分析)