Created
February 19, 2019 23:37
-
-
Save ericness/8b148916f89efbff14f61de23fc1a410 to your computer and use it in GitHub Desktop.
Compute the pandas dataframe from the dask dataframe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def compute_final_dataframe(df: dd.DataFrame) -> pd.DataFrame: | |
| """Execute dask task graph and compute final results""" | |
| return ( | |
| df | |
| .compute() | |
| .reset_index() | |
| .pivot( | |
| index='drive_time', | |
| columns='trip_distance', | |
| values='avg_amount' | |
| ) | |
| .fillna(0) | |
| ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment