gpt4 book ai didi

python - graphlab SFrame 对一列中的所有值求和

转载 作者:太空狗 更新时间:2023-10-30 01:00:01 24 4
gpt4 key购买 nike

如何对 SFrame graphlab 的一列中的所有值求和。我试着查看官方文档,它只针对 SaArray( doc )没有任何例子。

最佳答案

>>> import graphlab as gl
>>> sf = gl.SFrame({'foo':[1,2,3], 'bar':[4,5,6]})
>>> sf
Columns:
bar int
foo int

Rows: 3

Data:
+-----+-----+
| bar | foo |
+-----+-----+
| 4 | 1 |
| 5 | 2 |
| 6 | 3 |
+-----+-----+
[3 rows x 2 columns]
>>> sf['foo'].sum()
6

关于python - graphlab SFrame 对一列中的所有值求和,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39277805/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com