Skip to content

Instantly share code, notes, and snippets.

@aniruddha27
Last active June 15, 2020 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aniruddha27/0250c4b9d2dffcc5b4847d6efb5b9077 to your computer and use it in GitHub Desktop.
Save aniruddha27/0250c4b9d2dffcc5b4847d6efb5b9077 to your computer and use it in GitHub Desktop.
df['Item_Weight'] = df.groupby(['Item_Fat_Content','Item_Type'])['Item_Weight'].transform(lambda x: x.fillna(x.mean()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment