graphlab SFrame对列中的所有值求和

Pra*_*kar 5 python graphlab

如何对SFrame graphlab列中的所有值求和.我试着查看官方文档,它仅为SaArray(doc)提供,没有任何示例.

Adr*_*aud 4

>>> 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
Run Code Online (Sandbox Code Playgroud)