How can I drop or disable the indices in a pandas Data Frame?
I am learning the pandas from the book \"python for data analysis\" and I already know I can use the datafr
Additionally, if you are using the df.to_excel
function of a pd.ExcelWriter
, which is where it is written to an Excel worksheet, you can specify index=False
in your parameters there.
create the Excel writer:
writer = pd.ExcelWriter(type_box + '-rules_output-' + date_string + '.xlsx',engine='xlsxwriter')
We have a list called lines
:
# create a dataframe called 'df'
df = pd.DataFrame([sub.split(",") for sub in lines], columns=["Rule", "Device", "Status"]))
#convert df to Excel worksheet
df.to_excel(writer, sheet_name='all_status',**index=False**)
writer.save()