在 dask 中的 if-else 之后创建一个新列
df['new_col'] = np.where(df['col1'] == df['col2'] , True, False),其中 col1 和 col2 都是 str 数据类型,看起来很漂亮直接向前。在 if else 语句之后在 dask 中创建列的更有效方法是什么?我尝试了此建议 在中创建 if-else 条件列dask dataframe 但这需要很长时间。大约一个小时后,它只处理了大约 30%。我有 1300 万行和 70 列
df[‘new_col’] = np.where(df[‘col1’] == df[‘col2’] , True, False)
, where col1 and col2 are both str data types, seems pretty straight forward. What is the more efficient method to create a column in dask after an if else statement? I tried the recommendation from this Create an if-else condition column in dask dataframe but it is taking forever. It has only processed about 30% after about an hour. I have 13mil rows and 70 columns
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果需要将列设置为布尔值,则使用 IIUC:
如果需要设置为其他值:
IIUC use if need set column to boolean:
If need set to another values: