2017-11-18 88 views
3

我想根據一組索引鍵獲取Dask數據幀的行的子集。 (具體來說,我想查找其索引不在ddf2索引中的ddf1行)。Dask:通過索引從Dataframe中刪除(或丟棄)行

cache.drop([overlap_list])diff = cache[should_keep_bool_array]都會拋出NotImplementedException,否則不起作用。

這樣做的最好方法是什麼?

+0

dask中的索引操作的功能相當有限。例如,['Index.difference'](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Index.difference.html#pandas.Index.difference)將是直接的實現,但它的也沒有實施。 –

回答

0

我不知道這是「最好」的方式,但在這裏就是我最後做它:

  1. 與索引創建熊貓數據幀是我想保持系列的索引鍵(例如,pd.DataFrame(index=overlap_list)
  2. 內加入DASK數據幀
0

另一種可能性是:

df_index = df.reset_index() 
df_index = df_index.dorp_dplicates() 
相關問題