What is the iloc equivalent to dask dataframe?

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

For example, I would like

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? (for example, maybe the positional location is not defined correctly?) In this case, what can I do if I only know the positional indices (not labels) of the values ​​that I need to get?

+4
source share
1 answer

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

+1
source

Source: https://habr.com/ru/post/1687566/


All Articles