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


Python Windows.get_dates方法代碼示例

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


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

示例1: calc_freq

# 需要導入模塊: import Windows [as 別名]
# 或者: from Windows import get_dates [as 別名]
def calc_freq(date_from,date_to,window_size,wanted_list,n,search=[]):
    groups,wanted_list = group(wanted_list)
    # list of tuples of dates
    all_dates = Windows.get_dates(date_from,date_to,365)  # these are not windows, smaller problems
    # for dates and frequencies
    x = []
    y = np.empty((len(wanted_list), 0)).tolist()
    stevec = 0
    print('grem v zanke')
    for tup in all_dates:
        print('leto')
        windows, time = Windows.get_windows(tup[0], tup[1], window_size,search)
        print('windows')
        x += time
        if n==1: grams = count_words(wanted_list,windows)
        else: grams, words_per_window = N_grams.list_of_ngrams(windows, n)
        print('ngrami narjeni')
        for count, i in enumerate(grams):
            #words = words_per_window[count]  #to calculate frequency
            #besede.append(words)
            words =  besede[stevec]
            stevec+=1
            for j,wanted in enumerate(wanted_list):
                frequency = 0
                if wanted in i:
                    frequency = i[wanted] / words
                y[j].append(frequency)
        
        print('ngrami presteti')
    #print(besede)
    print('plotam')
    #print(x,y,wanted_list,groups)
            
    plot(x,y,wanted_list,groups)
    return x,y
開發者ID:zadnjipuki,項目名稱:Analiza-spletnih-novic,代碼行數:37,代碼來源:Timeline.py


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