小编cha*_*cab的帖子

不能用灵活型进行缩减

我有这个数据集:

           Game1    Game2   Game3   Game4     Game5

Player1       2        6        5       2        2

Player2       6        4        1       8        4

Player3       8        3        2       1        5

Player4       4        9        4       7        9
Run Code Online (Sandbox Code Playgroud)

我想为每个玩家计算5场比赛的总和.

这是我的代码:

import csv
f=open('Games','rb')
f=csv.reader(f,delimiter=';')
lst=list(f)
lst
import numpy as np
myarray = np.asarray(lst)
x=myarray[1,1:] #First player
y=np.sum(x)
Run Code Online (Sandbox Code Playgroud)

我有错误"无法使用灵活类型执行缩减".我真的很陌生,我需要你的帮助.

谢谢

python numpy python-2.7

5
推荐指数
1
解决办法
3万
查看次数

标签 统计

numpy ×1

python ×1

python-2.7 ×1