Skip to content

Instantly share code, notes, and snippets.

@ericness
Created February 19, 2019 23:37
Show Gist options
  • Select an option

  • Save ericness/8b148916f89efbff14f61de23fc1a410 to your computer and use it in GitHub Desktop.

Select an option

Save ericness/8b148916f89efbff14f61de23fc1a410 to your computer and use it in GitHub Desktop.
Compute the pandas dataframe from the dask dataframe.
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