Created
July 15, 2020 08:53
-
-
Save gautierdag/bf77ebb4c30bd6fa16d21db03b92f945 to your computer and use it in GitHub Desktop.
Shift Date Compression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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