當前位置: 首頁>>代碼示例>>Python>>正文


Python MOSES.getbbc方法代碼示例

本文整理匯總了Python中MOSES.getbbc方法的典型用法代碼示例。如果您正苦於以下問題:Python MOSES.getbbc方法的具體用法?Python MOSES.getbbc怎麽用?Python MOSES.getbbc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MOSES的用法示例。


在下文中一共展示了MOSES.getbbc方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: getEfficiencyData

# 需要導入模塊: import MOSES [as 別名]
# 或者: from MOSES import getbbc [as 別名]
def getEfficiencyData(query_date=None):
    #Set the date.
    if query_date is None:
        query_date = datetime.date.today()
    
    user_id, password = MOSES.getbbc()

    #Get a list of dictionaries pertaining to writers' data.
    writers_data_list = MOSES.getWritersList(user_id, password, query_date)

    #get a sorted list of writers' employee IDs.
    writers_ids = [writer["Employee ID"] for writer in writers_data_list]
    writers_ids.sort()

    writer_count = len(writers_ids)

    #For each writer, get the efficiency, work status, cfm and gseo.
    writer_data_frame = pd.DataFrame(columns=["Employee ID","Employee Name","Status","Efficiency","CFM","GSEO","Efficiency Color","CFM Color", "GSEO Color"]                                    )

    #create a pandas dataframe with the following columns:
    #writerid, writer_name, work_status, efficiency, cfm, gseo, stack_rank_index

    red = "#FF3325"
    green = "#43AD38"
    blue = "#027CD5"
    bright_blue = "#027CD5"
    grey = "0.75"
    writer_counter = 0
    for writer in writers_data_list:
        writer_id = writer["Employee ID"]
        writer_name = "%s" %writer["Name"][:writer["Name"].find(" ")]
        status, relaxation, approval = MOSES.checkWorkStatus(user_id, password, query_date, writer_id)
        if status == "Working":
            efficiency = MOSES.getEfficiencyFor(user_id, password, query_date, writer_id)
        else:
            efficiency = 100.00
        cfm = MOSES.getCFMFor(user_id, password, query_date, writer_id)
        gseo = MOSES.getGSEOFor(user_id, password, query_date, writer_id)
        if status == "Working":
            efficiency *= 100.000
            efficiency = np.around(efficiency,3)
            if efficiency < 100.000:
                efficiency_color = red
            elif 100.000 <= efficiency < 105.000:
                efficiency_color = green
            elif 105.000 <= efficiency < 110.000:
                efficiency_color = blue
            else:
                efficiency_color = bright_blue
        else:
            efficiency_color = grey
        #print efficiency, efficiency_color
        if cfm < 95.000:
            cfm_color = red
        elif 95.000 <= cfm < 97.000:
            cfm_color = green
        elif 97.000 <= cfm < 99.000:
            cfm_color = blue
        else:
            cfm_color = bright_blue
        if gseo < 95.000:
            gseo_color = red
        elif 95.000 <= gseo < 97.000:
            gseo_color = green
        elif 97.000 <= gseo < 99.000:
            gseo_color = blue
        else:
            gseo_color = bright_blue
        writer_array = [writer_id, writer_name, status, efficiency, 
                    cfm, gseo, efficiency_color, cfm_color, gseo_color]
        #print writer_array
        writer_data_frame.loc[writer_counter] = writer_array
        writer_counter+=1
    writer_data_frame.sort(["Efficiency","CFM","GSEO"], ascending = [0,0,0], inplace = True)
    return writer_data_frame
開發者ID:vinay87,項目名稱:oink,代碼行數:77,代碼來源:Graphinator.py


注:本文中的MOSES.getbbc方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。