本文整理汇总了Python中MOSES.getFirstDayOfWeek方法的典型用法代码示例。如果您正苦于以下问题:Python MOSES.getFirstDayOfWeek方法的具体用法?Python MOSES.getFirstDayOfWeek怎么用?Python MOSES.getFirstDayOfWeek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MOSES
的用法示例。
在下文中一共展示了MOSES.getFirstDayOfWeek方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getWriterStatsForDate
# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import getFirstDayOfWeek [as 别名]
def getWriterStatsForDate(self, query_date):
lwd = MOSES.getLastWorkingDate(self.user_id, self.password, query_date)
lwd_efficiency = None
lwd_cfm, lwd_gseo, lwd_fatals = None, None, None
previous_dictionary = self.result_dictionary.get(lwd)
if lwd in self.getProcessedDates():
lwd_efficiency = previous_dictionary.get("Efficiency")
lwd_cfm = previous_dictionary.get("CFM")
lwd_gseo = previous_dictionary.get("GSEO")
lwd_fatals = previous_dictionary.get("Fatals")
if lwd_efficiency is None or lwd_cfm is None or lwd_gseo is None or lwd_fatals is None:
self.updateResultsDictionaryForDate(lwd)
previous_dictionary = self.result_dictionary.get(lwd)
lwd_efficiency = previous_dictionary.get("Efficiency")
previous_dictionary = self.result_dictionary.get(lwd)
lwd_cfm = previous_dictionary.get("CFM")
lwd_gseo = previous_dictionary.get("GSEO")
lwd_fatals = previous_dictionary.get("Fatals")
stats_keys = ["Time Frame", "Efficiency", "CFM", "GSEO"]
lwd_stats = [lwd, lwd_efficiency, lwd_cfm, lwd_gseo]
first_date_of_week = MOSES.getFirstDayOfWeek(lwd)
if first_date_of_week == lwd:
cw_stats = ["Week#%d"%lwd.isocalendar()[1]] + lwd_stats[1:]
else:
cw_efficiency = MOSES.getEfficiencyForWeek(self.user_id, self.password, lwd, category_tree=self.category_tree)
cw_cfm, cw_gseo, cw_fatals = MOSES.getCFMGSEOForWeek(self.user_id, self.password, lwd)
cw_stats = ["Week#%d"%lwd.isocalendar()[1], cw_efficiency, cw_cfm, cw_gseo]
cm_efficiency = MOSES.getEfficiencyForMonth(self.user_id, self.password, lwd, category_tree=self.category_tree)
cm_cfm, cm_gseo, cm_fatals = MOSES.getCFMGSEOForMonth(self.user_id, self.password, lwd)
current_month = lwd.strftime("%b") if (len(lwd.strftime("%B"))>6) else lwd.strftime("%B")
cm_stats = [current_month, cm_efficiency, cm_cfm, cm_gseo]
stats = [lwd_stats, cw_stats, cm_stats]
formatted_stats = []
for row in stats:
formatted_row = [row[0]]
for item in row[1:]:
if (type(item) is str) or (item is None):
item = "-"
elif math.isnan(item) :
item = "-"
else:
item = "%6.3f%%"%(item*100)
formatted_row.append(item)
formatted_stats.append(formatted_row)
return pd.DataFrame(formatted_stats, columns=stats_keys)