def main(): for format_sheet in range(2): #runs through the code twice: once without and once with formatting column widths if format_sheet == 0: network = net_summary.add_worksheet('Network') screenlines = net_summary.add_worksheet('Screenlines') # this isn't working #countstime = net_summary.add_worksheet('CountsTime') #countsall = net_summary.add_worksheet('CountsAll') highway_summary(network, net_summary, format_sheet, times, screenlines) if format_sheet == 1: colwidths = xlautofit.even_widths_single_index(output_file) net_summary.close()
def main(): for format_sheet in range(2): #runs through the code twice: once without and once with formatting column widths if format_sheet == 0: network = net_summary.add_worksheet('Network') transit = net_summary.add_worksheet('Transit') screenlines = net_summary.add_worksheet('Screenlines') countstime = net_summary.add_worksheet('CountsTime') countsall = net_summary.add_worksheet('CountsAll') amtransitall = net_summary.add_worksheet('AMTransitAll') mdtransitall = net_summary.add_worksheet('MDTransitAll') transit_summary(transit_df, net_summary, transit, amtransitall, mdtransitall) highway_summary(network, net_summary, format_sheet, times, screenlines, countstime, countsall) if format_sheet == 1: colwidths = xlautofit.even_widths_single_index(output_file) net_summary.close()
excel_writer=writer, sheet_name="Arrivals and Departures by Hour", na_rep="-", startrow=1, startcol=4 * i + 1, index=False, ) sheet = "Arrivals and Departures by Hour" worksheet = writer.sheets[sheet] if i != len(times): worksheet.write(0, 4 * i, " ") arrival_mode_split.to_excel(excel_writer=writer, sheet_name="Arrival Mode Split", na_rep="-") departure_mode_split.to_excel(excel_writer=writer, sheet_name="Departure Mode Split", na_rep="-") writer.save() colwidths = xlautofit.even_widths_single_index("Q:/soundcast/outputs/Regional_Centers.xlsx") writer = pd.ExcelWriter("Q:/soundcast/outputs/Regional_Centers.xlsx", engine="xlsxwriter") mode_split.to_excel(excel_writer=writer, sheet_name="Mode Split", na_rep="-") work_mode_split.to_excel(excel_writer=writer, sheet_name="Work Trip Mode Split", na_rep="-") work_dest_mode_split.to_excel(excel_writer=writer, sheet_name="Work Destination Mode Split", na_rep="-") miles_traveled.to_excel(excel_writer=writer, sheet_name="VMT and PMT", na_rep="-") workbook = writer.book header_format = workbook.add_format({"bold": "True", "align": "center", "border": 1}) top_5_format = workbook.add_format({"font_color": "#006060", "bold": "True"}) bot_5_format = workbook.add_format({"font_color": "#600060", "bold": "True"}) for i in range(len(times)): if i == 0: trips_by_time[times[i]].to_excel( excel_writer=writer, sheet_name="Arrivals and Departures by Hour", na_rep="-", startrow=1 )
] location = os.getcwd().replace("\\", "/") output_file = location + "/Weekly Forecasts/Week" + str(week_number) + ".xlsx" for read_data in range(2): week_book = xlsxwriter.Workbook(output_file) header_format = week_book.add_format({"align": "center", "bold": True, "bottom": True}) index_format = week_book.add_format({"align": "right", "bold": True}) score_format = week_book.add_format({"num_format": "#0", "align": "right"}) percent_format = week_book.add_format({"num_format": "#0%", "align": "right"}) if read_data: colwidths = xlautofit.even_widths_single_index(output_file) for game_time in matchups: if read_data: data_book = xlrd.open_workbook(output_file) data_sheet = data_book.sheet_by_name(game_time) sheet = week_book.add_worksheet(game_time) sheet.write_string(1, 0, "Chance of Winning", index_format) sheet.write_string(2, 0, "Expected Score", index_format) sheet.write_string(3, 0, "2.5th Percentile Score", index_format) sheet.write_string(4, 0, "10th Percentile Score", index_format) sheet.write_string(5, 0, "25th Percentile Score", index_format) sheet.write_string(6, 0, "50th Percentile Score", index_format) sheet.write_string(7, 0, "75th Percentile Score", index_format) sheet.write_string(8, 0, "90th Percentile Score", index_format) sheet.write_string(9, 0, "97.5th Percentile score", index_format)
startrow=1, startcol=4 * i + 1, index=False) sheet = 'Arrivals and Departures by Hour' worksheet = writer.sheets[sheet] if i != len(times): worksheet.write(0, 4 * i, ' ') arrival_mode_split.to_excel(excel_writer=writer, sheet_name='Arrival Mode Split', na_rep='-') departure_mode_split.to_excel(excel_writer=writer, sheet_name='Departure Mode Split', na_rep='-') writer.save() colwidths = xlautofit.even_widths_single_index( 'Q:/soundcast/outputs/Regional_Centers.xlsx') writer = pd.ExcelWriter('Q:/soundcast/outputs/Regional_Centers.xlsx', engine='xlsxwriter') mode_split.to_excel(excel_writer=writer, sheet_name='Mode Split', na_rep='-') work_mode_split.to_excel(excel_writer=writer, sheet_name='Work Trip Mode Split', na_rep='-') work_dest_mode_split.to_excel(excel_writer=writer, sheet_name='Work Destination Mode Split', na_rep='-') miles_traveled.to_excel(excel_writer=writer, sheet_name='VMT and PMT', na_rep='-') workbook = writer.book header_format = workbook.add_format({