Reputation: 147
df = dd.read_csv('csv',usecols=fields,skip_blank_lines=True)
len(df.iloc[0:5])
The above code raises
AttributeError: 'DataFrame' object has no attribute 'iloc'
tried ix loc but unable select rows based on index
Upvotes: 4
Views: 5790
Reputation: 20962
One workaround is to create the index as a column, i.e. df_index
, in your csv file and use it like so:
selection = (df[ df['df_index'].isin( list_of_indexes ) ]).compute()
Upvotes: 3
Reputation: 57319
Dask.dataframe does not support iloc
. Generally it's quite hard to do access any particular row in a csv file without first reading it all into memory.
However if you only want a few of the rows at the top then I recommend using the .head()
method
>>> df.head()
Upvotes: 4