python - 将 sframe 列转换为列表

标签 python graphlab sframe

我需要将 SFrame 列转换为列表。

输入:

 `+---------+
  |   word  |
  +---------+
  |   love  |
  |  loves  |
  |   easy  |
  | perfect |
  |  great  |
  +---------+`

输出:

['love', 'loves', 'easy', 'perfect', 'great']

最佳答案

我很惊讶 list 函数给了你一个错误。这对我有用:

import graphlab as gl
sf = gl.SFrame({'fruit': ['apple', 'banana', 'pear']})
list(sf['fruit'])

返回:

['apple', 'banana', 'pear']

关于python - 将 sframe 列转换为列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36253988/

相关文章:

python - 带单引号且不带转义字符的 JSON 对象

python - 在 Go 中枚举常量的最佳方法

python - graphlab-sframe : How to remove rows which have same ids and condition on a column?

machine-learning - 加载 graphlab.SFrame 时出错 ('home_data.gl/' )

python - 来自 numpy 数组的 SFrame

pandas - Pandas 中是否有 GraphLab SFrame.show() 等价物?

Python 的请求会触发 Cloudflare 的安全性,而 urllib 不会

python - Django 2 命名空间和 app_name

python - 如何在Python中乘以数组中每个元素的每个值?

python - 下载 Graphlab 依赖项的问题 get_dependencies()