Skip to content

Instantly share code, notes, and snippets.

@zhangr4
Created June 24, 2022 02:22
Show Gist options
  • Save zhangr4/5a03f3d059434cee6691e448e0426254 to your computer and use it in GitHub Desktop.
Save zhangr4/5a03f3d059434cee6691e448e0426254 to your computer and use it in GitHub Desktop.
import pandas as pd
a = pd.DataFrame([1,2,2,3,3,3,1,1,2])
b = a.loc[:,0]
c = b.loc[b.shift()!=b]
print(c.tolist())
// https://stackoverflow.com/questions/19463985/pandas-drop-consecutive-duplicates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment