- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
给定一个 Graphlab SFrame:
+-------+------------+---------+-----------+
| Store | Date | Sales | Customers |
+-------+------------+---------+-----------+
| 1 | 2015-07-31 | 5263.0 | 555.0 |
| 2 | 2015-07-31 | 6064.0 | 625.0 |
| 3 | 2015-07-31 | 8314.0 | 821.0 |
| 4 | 2015-07-31 | 13995.0 | 1498.0 |
| 3 | 2015-07-20 | 4822.0 | 559.0 |
| 2 | 2015-07-10 | 5651.0 | 589.0 |
| 4 | 2015-07-11 | 15344.0 | 1414.0 |
| 5 | 2015-07-23 | 8492.0 | 833.0 |
| 2 | 2015-07-19 | 8565.0 | 687.0 |
| 10 | 2015-07-09 | 7185.0 | 681.0 |
+-------+------------+---------+-----------+
[986159 rows x 4 columns]
如何通过将每行的销售额除以客户数来添加“每位客户的销售额”列?
我已尝试以下方法,但它们不起作用(sf
是我的SFrame
:
sf['salespercustomer'] = sf.apply(lambda x: sf['Sales']/sf['Customers'])
有趣的是,我得到了 SArray 的输出:
sf['Sales'] / sf['Customers']
但这并不能真正帮助将列添加回 sf
,因此这不起作用 =( :
sf['salescustomer'] = sf['Sales'] / sf['Customers']
最佳答案
最后一行代码应该可以解决问题,但你说你的 SFrame 名为 sf
,而不是 train
。当我用 sf
尝试它时,它工作得很好。
关于python - 如何在 Graphlab SFrame 中通过划分两列来创建新列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33792798/
在“import graphlab”时发生以下情况: ACTION REQUIRED: Dependencies libstdc++-6.dll and libgcc_s_seh-1.dll not
我尝试通过 pip 安装 GraphLab Create。快速穿过台阶,直到最后一步让我停住了脚步。最终命令: pip install --upgrade --no-cache-dir https:/
我有一个具有多个输入的函数,并且想使用SFrame.apply创建一个新列。我找不到将两个参数传递给SFrame.apply的方法。 理想情况下,它将列中的条目作为第一个参数,而我将传入第二个参数。直
我已加入 coursera 上的机器学习类(class)。我在执行以下命令时遇到问题: sales = graphlab.SFrame('home_data.gl/') 错误如下: IOErr
当我尝试导入 graphlab 时,出现 ImportError。我的 MacBook 使用 OSX Yosemite 10.10.4。我确实有 anaconda,但我的 envs 文件夹是空的。根据
如何对 SFrame graphlab 的一列中的所有值求和。我试着查看官方文档,它只针对 SaArray( doc )没有任何例子。 最佳答案 >>> import graphlab as gl >
给定一个 Graphlab SFrame: +-------+------------+---------+-----------+ | Store | Date | Sales |
我一直在学习 Graphlab,但也想看看 pandas,因为它是开源的,将来我可能会发现自己在一家没有 GL 许可证的公司,我想知道 pandas 如何可以像使用 GL 一样创建基本模型。 data
有一个 SFrame,其中的列具有 dict 元素。 import graphlab import numpy as np a = graphlab.SFrame({'col1':[{'oshan':
我想在您的帮助下计算以下错误: 需要采取措施:未找到依赖项 libstdc++-6.dll 和 libgcc_s_seh-1.dll。 确保用户帐户具有对 C:\GraphLab\IntalledPa
我目前正在学习华盛顿大学提供的 Coursera(机器学习)类(class),我在使用 numpy 和 graphlab 时遇到了一些小问题 类(class)要求使用1.7以上的graphlab版本我
我有两列字符串。让我们说 col1 和 col2现在我们如何使用 graphlab SFrame 将 col1 和 col2 的内容合并到 col3 中? col1 col2 23 33 42
我有一个 SFrame,其外观与 sf.print_rows(10) 类似: +--------------+---------------+-------+---------------------
我在让 graphlab 工作时遇到了一些问题。每次我想导入 graphlab 时,我都会收到消息: ACTION REQUIRED: Dependencies libstdc++-6.dll and
为什么创建“gl-env”会出现问题?我也试过重新安装它……但没有任何帮助。 CIO_TEST: CONDA_DEFAULT_ENV: CONDA_ENVS_PATH: PATH: C:\Use
当我尝试下载运行 graphlab 所需的依赖项时遇到问题。我执行 import graphlab 我得到以下信息: ACTION REQUIRED: Dependencies libstdc++-6
我最近升级了我拥有的 Graph Lab 创建版本。使用 Jupyter 控制台运行代码时,出现以下错误: from __future__ import division import graphla
所以,一周前我开始使用 Graphlab 来参加我的机器学习类(class)。我对 Graphlab 还很陌生,我通读了 API,但无法完全得到我正在寻找的解决方案。那么,问题来了。我有多个列的数据,
运行 gl.canvas.set_target('ipynb') 会在 docker 容器中抛出以下异常。 即使使用 gl.canvas.set_target('ipynb', port=28892)
我正在使用 graphlab 库中的 sframes。我需要按行进行一些计算。此外,如果我能够转置 sframe,则 sframe 结构在我的情况下会更有意义。 有什么办法可以做到吗?还是可以在我可以
我是一名优秀的程序员,十分优秀!