Skip to content

Instantly share code, notes, and snippets.

@kvnkho
Last active March 17, 2021 18:56
Show Gist options
  • Save kvnkho/2965be63dcf3859d1674982e575ab348 to your computer and use it in GitHub Desktop.
Save kvnkho/2965be63dcf3859d1674982e575ab348 to your computer and use it in GitHub Desktop.
Simple median
#schema: user_id:int, measurement:int
def get_median(df:pd.DataFrame) -> pd.DataFrame:
return pd.DataFrame({'user_id': [df.iloc[0]['user_id']],
'median' : [df[['measurement']].median()]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment