chrt.set_legend({'position': 'bottom'})
        chrt.set_x_axis({'major_tick_mark': 'none'})
        chrt.set_y_axis({
            'major_tick_mark': 'none',
            'visible': False,
            'major_gridlines': {
                'visible': False
            }
        })
        chrt.set_title({
            'name':
            yrs + ' ' + county +
            ' County Crashes Involving Unrestrained Occupants'
        })
        wrksht.insert_chart('K2', chrt)
        temp_df.to_excel(writer, county)

        #pt.to_excel(writer)
    writer.save()
    writer.close()

    return os.path.join(resultdir, 'Seatbelt.xlsx')


if __name__ == "__main__":
    txt = "C:/Users/" + usr + "/OneDrive/Documents/Work Computer Files/20170609-1536-gcat-results48466.csv"
    mtcfCsv = "C:/Users/" + usr + "/OneDrive/Documents/Work Computer Files/MTCF2012to2014_5June17_2897.csv"
    seatbelttbl(
        schemaCleaner(txt, mtcfCsv, "C:/Users/" + usr + "/Desktop")[0],
        "C:/Users/" + usr + "/Desktop")
Exemple #2
0
                             'data_labels': {'value': True},
                             'name': 'Non-Incapacitating & Possible Injury Drug'})

        chrt.add_series({'categories': ['Drug_Alcohol', dict[key][0], 0, dict[key][1], 0],
                             'values': ['Drug_Alcohol', dict[key][0], 9, dict[key][1], 9],
                             'data_labels': {'value': True},
                             'name': 'Property Damage Alcohol'})

        chrt.add_series({'categories': ['Drug_Alcohol', dict[key][0], 0, dict[key][1], 0],
                             'values': ['Drug_Alcohol', dict[key][0], 10, dict[key][1], 10],
                             'data_labels': {'value': True},
                             'name': 'Property Damage Drug',
                             'overlap': ovrlp})
        chrt.set_x_axis({'major_tick_mark': 'none'})
        chrt.set_y_axis({'major_tick_mark': 'none',
                         'line': {'none':True},
                         'visible': False,
                         'major_gridlines':{'visible': False}})
        chrt.set_title({'name': yrs + ' ' + key + ' County Alcohol & Drug Related Crashes'})
        chrt.set_legend({'position': 'bottom'})
        chrtsht.set_chart(chrt)
    #writer.save() saving after each step seems to make subsequent charts not insert


    writer.save()
    return os.path.join(resultdir,"Alcohol_Drug.xlsx")
if __name__ == "__main__":
    txt = "C:/Users/" + usr + "/OneDrive/Documents/Work Computer Files/20170609-1536-gcat-results48466.csv"
    mtcfCsv = "C:/Users/" + usr + "/OneDrive/Documents/Work Computer Files/MTCF2012to2014_5June17_2897.csv"
    alcoholdrugtbl(schemaCleaner(txt, mtcfCsv, "C:/Users/" + usr + "/Desktop")[0], "C:/Users/" + usr + "/Desktop")
                                 'name': 'Fatal',
                                 'fill': {'color':'red'}})
            chrtfii.add_series({'categories': [county + dictofcolumns[clmn][0], 1, 0, len(temp_df) - 1, 0],
                                 'values': [county + dictofcolumns[clmn][0], 1, 2, len(temp_df) - 1, 2],
                                 'data_labels': {'value': False},
                                 'name': 'Incapacitating Injury',
                                 'overlap': ovrlp,
                                 'fill':{'color': 'yellow'}})
            chrtfii.set_title(
                {'name': yrs + ' ' + county + ' County Fatal & Incapacitating Crashes by ' + dictofcolumns[clmn][0]})
            chrtfii.set_legend({'position':'bottom'})
            chrtfii.set_x_axis({'major_tick_mark': 'none'})
            chrtfii.set_y_axis({'major_tick_mark': 'none',
                                'line': {'none': True}})
            chrtsht.set_chart(chrtfii)

            wrksht.insert_chart('L2',chrt)
            temp_df.to_excel(writer,county + dictofcolumns[clmn][0])


        #pt.to_excel(writer)
    writer.save()
    writer.close()
    xlfile = 'C:/Users/fullerm/Desktop/Tables.xlsx'
    print(type(xlfile))
    return os.path.join(resultdir,  'Tables.xlsx')
if __name__ == "__main__":
    txt = "C:/Users/" + usr + "/OneDrive/Documents/Work Computer Files/20170609-1536-gcat-results48466.csv"
    mtcfCsv = "C:/Users/" + usr + "/OneDrive/Documents/Work Computer Files/MTCF2012to2014_5June17_2897.csv"
    crashtypetbl(schemaCleaner(txt,mtcfCsv,"C:/Users/" + usr + "/Desktop")[0],"C:/Users/" + usr + "/Desktop")
Exemple #4
0
    arcpy.GetParameterAsText(3))  # user input weight for serious crashes
# seriouswt = 39.22  # user input weight for serious crashes
nonseriouswt = float(
    arcpy.GetParameterAsText(4))  # user input weight for nonserious crashes
# nonseriouswt = 6.84  # user input weight for nonserious crashes
possiblewt = float(
    arcpy.GetParameterAsText(5))  # user input weight for possible crashes
# possiblewt = 4.63  # user input weight for possible crashes
# curious that these two thresholds don't have to be numbers
IntersectionThreshold = arcpy.GetParameterAsText(
    6)  # user input number of crashes to qualify an intersection as high crash
# IntersectionThreshold = str(20)  # user input number of crashes to qualify an intersection as high crash
SegmentThreshold = arcpy.GetParameterAsText(7)
# SegmentThreshold = str(30)
lst = schemaCleaner(
    GCATfile, MTCFfile,
    GDBspot)  # returns list containing df[0] and csv location[1]

# list of xlsx file with top locations[0], and new df with county/municipality based on location[1]
# spatialList =
xlFiles = [
    crashReportLRS(GDBspot, lst[1], fatalwt, seriouswt, nonseriouswt,
                   possiblewt, IntersectionThreshold, SegmentThreshold),
    tblCrashYear(lst[0], GDBspot),
    crashtypetbl(lst[0], GDBspot),
    tblCrashF_II(lst[0], GDBspot),
    # overallfii(lst[0],GDBspot),
    alcoholdrugtbl(lst[0], GDBspot),
    drugalcoholfii(lst[0], GDBspot),
    seatbelttbl(
        lst[0], GDBspot