You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is not possible to perform trivial operations like standardization of data e.g.
ddf = (ddf - ddf.mean(axis=0)) / ddf.std(axis=0)
It throws an error saying
ValueError: Not all divisions are known, can't align partitions.
Please use `set_index` or `set_partition` to set the index.
The output of the reduction operations are Series with one row and same number of columns so it shouldn't need to know the divisions. However, would it make sense to set the divisions of the Series to be the start and end divisions of the DataFrame that was reduced?
Interesting case, I suspect that you're right that it's seeing DataFrame + Series and assuming that the intended operation is row-wise. A good check here would be that the number of partitions of the series is one. I'm in favor of this change. Does anyone have the time to try to implement it?
Here is a minimal example I constructed from the same example in the documentation for map_partitions. What is interesting that this works with a dask dataframe constructed using from_pandas, but fails when constructed with from_csv.
This still isn't fixed for the minimal example I included. Am I understanding the expected behavior incorrectly? I would assume that whether dask.dataframe is created using from_pandas or read_csv they both should behave the same, but that is clearly not the case.
The error here is saying that "OK, you've given me a dask.dataframe with two partitions without any information about how those partitions are aligned. For example I don't know how many rows are in each partition. You've also given me a pandas series with 10 rows (or whatever). I have no idea how to split the pandas series to align with the partitions of the dask dataframe."
I would see the 'res' column included. Is the computation executed when head is called? If this is the case is it generally a best practice then to avoid calling compute if possible?
Activity
GrierPhillips commentedon Mar 10, 2017
+1
mrocklin commentedon Mar 10, 2017
Interesting case, I suspect that you're right that it's seeing DataFrame + Series and assuming that the intended operation is row-wise. A good check here would be that the number of partitions of the series is one. I'm in favor of this change. Does anyone have the time to try to implement it?
GrierPhillips commentedon Mar 10, 2017
Here is a minimal example I constructed from the same example in the documentation for
map_partitions. What is interesting that this works with a dask dataframe constructed usingfrom_pandas, but fails when constructed withfrom_csv.The above code returns
Support arithmetic with row-series
Support arithmetic with row-series (#2085)
GrierPhillips commentedon Mar 31, 2017
This still isn't fixed for the minimal example I included. Am I understanding the expected behavior incorrectly? I would assume that whether
dask.dataframeis created usingfrom_pandasorread_csvthey both should behave the same, but that is clearly not the case.mrocklin commentedon Mar 31, 2017
You probably don't want to call compute here
Instead just leave things as a dask dataframe/series
mrocklin commentedon Mar 31, 2017
The error here is saying that "OK, you've given me a dask.dataframe with two partitions without any information about how those partitions are aligned. For example I don't know how many rows are in each partition. You've also given me a pandas series with 10 rows (or whatever). I have no idea how to split the pandas series to align with the partitions of the dask dataframe."
GrierPhillips commentedon Mar 31, 2017
Oh. Interesting. So the values still end up being computed even without calling
compute. Is this a lazy execution for example if I tried:I would see the 'res' column included. Is the computation executed when
headis called? If this is the case is it generally a best practice then to avoid callingcomputeif possible?mrocklin commentedon Mar 31, 2017
Yes, dask.dataframe computations build on each other. You want to avoid calling compute for as long as possible.
goyal-neeraj commentedon Mar 1, 2018
pandas version 0.22
dask version 0.17
The map_partitions is not recognized, am I doing something wrong?
OR
mrocklin commentedon Mar 1, 2018
I recommend raising a new issue with a minimal reproducible example.
https://stackoverflow.com/help/mcve