Python 添加新列后,SFrame操作速度减慢

Python 添加新列后,SFrame操作速度减慢,python,machine-learning,graphlab,sframe,Python,Machine Learning,Graphlab,Sframe,我正在使用graphlab和sframes在ipython笔记本中创建重复订单报告。我有一个csv文件,包含大约10万行数据,其中包含用户id,用户电子邮件,用户电话。我添加了一个名为unique identifier的新列。对于每一行,我将遍历所有其他行,以查看user\u id、user\u email或user\u phone是否与当前记录匹配。如果unique identifier不为空且存在匹配项,我将当前记录中的user\u id分配到每个匹配记录的unique\u identifi

我正在使用graphlab和sframes在ipython笔记本中创建重复订单报告。我有一个csv文件,包含大约10万行数据,其中包含
用户id
用户电子邮件
用户电话
。我添加了一个名为unique identifier的新列。对于每一行,我将遍历所有其他行,以查看
user\u id
user\u email
user\u phone
是否与当前记录匹配。如果unique identifier不为空且存在匹配项,我将当前记录中的
user\u id
分配到每个匹配记录的unique\u identifier槽中

最后,我得到一个包含4列的SFrame,其中
unique\u identifier
包含所有匹配订单的最早订单的
user\u id
。我通过
执行此操作。使用lambda函数应用
方法。整个过程在我的笔记本电脑上只需几秒钟。但是,在该过程完成后,SFrame变得非常缓慢,无法管理,以至于SFrame.save似乎要花费很长时间

似乎我添加
唯一标识符的过程堵塞了内存或类似的东西。但是,问题与sframe大小无关。如果我将其限制为仅10行,则问题仍然存在。我做错了什么

这是我的方法

def set_unique_identifier():
  orders['unique_identifier'] = ''
  orders['unique_identifier'] = orders.apply(lambda order:      
       order['unique_identifier'] if order['unique_identifier'] else                                          
       orders[(orders['user_email']==order['user_email']) | 
       (orders['phone'] == order['user_phone'])][0]['user_id'])

不要在整个sframe上使用apply,而是在SArray上使用它,这样会加快一点速度

不要在整个sframe上使用apply,而是在SArray上使用它,这样会加快一点速度