亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

python提示“MemoryError”錯誤怎么辦?

python提示“MemoryError”錯誤怎么辦?

suxiao 2019-12-08 05:04:53
我想用python來 頻繁項目挖掘(一種大數據挖掘算法)來數據挖掘一個文件中的數據。數據量很大,用網上查到的代碼編寫好了以后,運行結果為“ array = np.zeros((len(X), len(self.columns_)), dtype=bool)? MemoryError”我不知道該怎么解決這個問題。代碼是正確的,因為如果將數據量減小就可以運行出來了,但是數據量變成原來那樣就顯示內存錯誤我的代碼很簡單:import pandas as pdimport numpy as npimport matplotlib.pyplot as pltfrom mlxtend.preprocessing import TransactionEncoderfrom mlxtend.frequent_patterns import apriori, association_rulesstudent_list = []file_handler =open('D:\lab\lab1\kosarak.dat',mode='r')?contents = file_handler.readlines()for name in contents:? ? name = name.strip('\n')? ? list_1 = name.split(' ')? ? student_list.append(list_1)te = TransactionEncoder()?te_ary = te.fit(student_list).transform(student_list)?df = pd.DataFrame(te_ary, columns=te.columns_)?frequent_itemsets = apriori(df, min_support=0.1, use_colnames=True)?print (frequent_itemsets)
查看完整描述

目前暫無任何回答

  • 0 回答
  • 1 關注
  • 6308 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號