【发布时间】:2019-01-24 09:53:01
【问题描述】:
在垂直连接两个时间戳索引的 dask Dataframe 时,我遇到了与 this 类似的问题。
我有两个 dask 数据框 df1,df2:
df1.index:
Dask Index Structure:
npartitions=1
2018-03-03 13:04:44.497929 datetime64[ns]
2018-03-03 13:23:04.759840 ...
Name: time, dtype: datetime64[ns]
Dask Name: getitem, 8 tasks
df2.index:
Dask Index Structure:
npartitions=1
2018-03-03 07:09:04.184453 datetime64[ns]
2018-03-03 07:32:46.815356 ...
Name: time, dtype: datetime64[ns]
Dask Name: getitem, 8 tasks
它们具有完全相同的列名和类型。现在我想使用 dask.dataframe.concat 连接它们:
#df1 & df2 are dask dataframes
print(df1.divisions)
print(df2.divisions)
dfs=dd.concat([df1,df2],axis=0,interleave_partitions=False)
输出:
(时间戳('2018-03-03 13:04:44.497929'), 时间戳('2018-03-03 13:23:04.759840')) (时间戳('2018-03-03 07:09:04.184453'),时间戳('2018-03-03 07:32:46.815356')) ValueError:所有输入都有无法按顺序连接的已知除法。指定 interleave_partitions=True 忽略顺序
两个 ddf 不能连接,除非指定 interleave_partitions=True。但是两个数据帧的索引之间没有交错。是不是dask支持datetimeindex的限制造成的?或者我需要指定其他参数或将索引转换为int或double?
【问题讨论】: