What is the equivalent to iloc for dask dataframe?

送分小仙女□ 提交于 2019-12-07 06:19:54

问题


I have a situation where I need to index a dask dataframe by location. I see that there is not an .iloc method available. Is there an alternative? Or am I required to use label-based indexing?

For example, I would like to

import dask.dataframe as dd
import numpy as np
import pandas as pd
df = dd.from_pandas(pd.DataFrame({k:np.random.random(10) for k in ['a', 'b']}), npartitions=2)
inds = [1, 4, 6, 8]
df.iloc[inds]

Is this not possible with dask? (e.g., Perhaps a positional location is not well-defined?) In this case, what can I do if I only know the positional indices (not labels) of the values I need to access?


回答1:


Positional indexing is not available for dask dataframe, nor is it likely to be available in the near future.



来源:https://stackoverflow.com/questions/46773660/what-is-the-equivalent-to-iloc-for-dask-dataframe

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!