Skip to content

Instantly share code, notes, and snippets.

@gautierdag
Created July 15, 2020 08:53
Show Gist options
  • Save gautierdag/bf77ebb4c30bd6fa16d21db03b92f945 to your computer and use it in GitHub Desktop.
Save gautierdag/bf77ebb4c30bd6fa16d21db03b92f945 to your computer and use it in GitHub Desktop.
Shift Date Compression
cols = [d for d in df.columns if d != "date"]
compressed_df = df.loc[~(df[cols].shift() == df[cols]).all(axis=1)].reset_index(drop=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment