I have a pandas dataframe that I converted to a dask dataframe using the from_pandas
function of dask. It has 3 columns namely col1
, col2
and col3
.
Now I am searching for a specific row using daskdf[(daskdf.col1 == v1) & (daskdf.col2 == v2)]
where v1
and v2
are values that I am searching for. But when I try to fetch the value of col3
using daskdf[(daskdf.col1 == v1) & (daskdf.col2 == v2)]['col3']
it gives me a dask series structure and not the column value.
In pandas I could do pandasdf[(pandasdf.col1 == v1) & (pandasdf.col2 == v2)]['col3'].tolist()
. How do I fetch the value of col3
here ?
Running .compute
will convert a dask
object into pandas
object, so the following will give the required result:
result = daskdf[(daskdf.col1 == v1) & (daskdf.col2 == v2)]['col3'].compute().tolist()