Skip to content

Instantly share code, notes, and snippets.

@FelixChop
Created April 12, 2020 10:08
Show Gist options
  • Save FelixChop/70bdb6d3e140f4c5247c5324f628b9c8 to your computer and use it in GitHub Desktop.
Save FelixChop/70bdb6d3e140f4c5247c5324f628b9c8 to your computer and use it in GitHub Desktop.
df.merge(
df.loc[
df.Ticket.isin(
df.Ticket.value_counts().loc[
df.Ticket.value_counts()>1
].index
)
].groupby('Ticket').apply(female_proportion) \
.reset_index().rename(columns={0:'proportion_female'}),
how='left', on='Ticket'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment