简体   繁体   English

从dask系列列表中创建dask DataFrame

[英]create dask DataFrame from a list of dask Series

I need to create aa dask DataFrame from a set of dask Series, analogously to constructing a pandas DataFrame from lists 我需要从一组dask系列创建一个dask DataFrame,类似于从列表构建一个pandas DataFrame

pd.DataFrame({'l1': list1, 'l2': list2})

I am not seeing anything in the API. 我没有在API中看到任何内容。 The dask DataFrame constructor is not supposed to be called by users directly and takes a computation graph as it's mainargument. dask DataFrame构造函数不应该由用户直接调用,并将计算图作为主要参数。

In general I agree that it would be nice for the dd.DataFrame constructor to behave like the pd.DataFrame constructor. 一般来说,我同意dd.DataFrame构造函数的行为与pd.DataFrame构造函数一样pd.DataFrame

If your series have well defined divisions then you might try dask.dataframe.concat with axis=1 . 如果你的系列有明确定义的分区,那么你可以尝试使用axis=1 dask.dataframe.concat

You could also try converting one of the series into a DataFrame and then use assignment syntax: 您还可以尝试将其中一个系列转换为DataFrame,然后使用赋值语法:

L = # list of series
df = L[0].to_frame()
for s in L[1:]:
    df[s.name] = s

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM