标签:ima color .com headers das port ade nump png
import numpy as np import pandas as pd recommond_matrix=np.zeros((3,4)) headers=[‘用户‘,‘食物‘,‘评分‘] df_rate=pd.read_csv(‘rate.csv‘,sep=‘\s‘,names=headers) print(df_rate) print(‘************************************************‘) for item in df_rate.itertuples(): recommond_matrix[item[1]-1][item[2]-1]=item[3] print(recommond_matrix)
import numpy as np import pandas as pd recommond_matrix=np.zeros((3,4)) headers=[‘用户‘,‘食物‘,‘评分‘] df_rate=pd.read_csv(‘rate.csv‘,sep=‘\s‘,names=headers) print(df_rate) print(‘************************************************‘) for item in df_rate.itertuples(): recommond_matrix[item[1]-1][item[2]-1]=item[3] print(recommond_matrix)
标签:ima color .com headers das port ade nump png
原文地址:https://www.cnblogs.com/liangliangzz/p/10267701.html