Skip to content

Instantly share code, notes, and snippets.

@seumasmorrison
Created June 30, 2015 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seumasmorrison/3b11e41f8c0d4cb2b0d5 to your computer and use it in GitHub Desktop.
Save seumasmorrison/3b11e41f8c0d4cb2b0d5 to your computer and use it in GitHub Desktop.
Deduping a DataFrame index
def dedupe_df(df):
df['index'] = df.index
df = df.drop_duplicates(subset='index')
df = df.drop("index",1)
return df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment