我想根据索引列表从 dask 数据框中选择行。我怎样才能做到这一点?
示例: 假设我有以下 dask 数据框。
dict_ = {'A':[1,2,3,4,5,6,7], 'B':[2,3,4,5,6,7,8], 'index':['x1', 'a2', 'x3', 'c4', 'x5', 'y6', 'x7']}
pdf = pd.DataFrame(dict_)
pdf = pdf.set_index('index')
ddf = dask.dataframe.from_pandas(pdf, npartitions = 2)
此外,我有一个我感兴趣的索引列表,例如
indices_i_want_to_select = ['x1','x3', 'y6']
由此,我想生成一个仅包含在indices_i_want_to_select