dask数据帧的iloc等效于什么? [英] What is the equivalent to iloc for dask dataframe?

查看:87
本文介绍了dask数据帧的iloc等效于什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种情况,我需要按位置索引dask数据框.我看到没有可用的 .iloc 方法.有其他选择吗?还是我需要使用基于标签的索引?

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?

例如,我想

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?

推荐答案

位置索引不适用于dask数据框,也不可能在不久的将来可用.

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

这篇关于dask数据帧的iloc等效于什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆