我认为您可以使用
dask.dataframe.from_pandas:
from dask import dataframe as dd sd = dd.from_pandas(df, npartitions=3)print (sd)dd.Dataframe<from_pa..., npartitions=2, divisions=(0, 1, 2)>
编辑:
我找到解决方案:
import pandas as pdimport dask.dataframe as ddfrom dask.dataframe.utils import make_metadf=pd.Dataframe({'a':[1,2,3],'b':[4,5,6]})dsk = {('x', 0): df}meta = make_meta({'a': 'i8', 'b': 'i8'}, index=pd.Index([], 'i8'))d = dd.Dataframe(dsk, name='x', meta=meta, divisions=[0, 1, 2])print (d)dd.Dataframe<x, npartitions=2, divisions=(0, 1, 2)>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)