pandas更改excel的column宽度

	df = pd.DataFrame(data=valuesDict,index=[0])

    # Create a Pandas Excel writer using XlsxWriter as the engine.
    writer = pd.ExcelWriter(os.path.join(ios_inspection_excel_file, file[:-4]) + '.xlsx', engine='xlsxwriter')
    # Convert the dataframe to an XlsxWriter Excel object.
    df.to_excel(writer, sheet_name='Sheet1')
    # Get the xlsxwriter worksheet object.
    worksheet = writer.sheets['Sheet1']
    # Set the column width and format.
    worksheet.set_column("B:Z", 25) # 在这里更改宽度值
    # Close the Pandas Excel writer and output the Excel file.
    writer.save()

你可能感兴趣的:(pandas更改excel的column宽度)