Skip to content

Instantly share code, notes, and snippets.

@admond1994
Created June 16, 2019 11:52
Show Gist options
  • Select an option

  • Save admond1994/b6d43ff2db793d9d091e16a8cc21d40d to your computer and use it in GitHub Desktop.

Select an option

Save admond1994/b6d43ff2db793d9d091e16a8cc21d40d to your computer and use it in GitHub Desktop.
def get_unique_last_str(df):
'''
AIM -> get unique last str for a column
INPUT -> df
OUTPUT -> updated df based on the unique last strings in a column
------
'''
df = df[df.index.isin(df['col_1'].drop_duplicates(keep='last').index)].reset_index(drop=True)
return df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment