SHARE
TWEET

Untitled

a guest Feb 9th, 2013 34 Never
  1. df = pd.DataFrame(np.random.randint(0,2,100), columns=['TossResults']) # random win(0) / lose (1)
  2. df['Steps'] = (df['TossResults'].cumsum()*df['TossResults']).diff()
  3. df['Edges'] = df['Steps']<0
  4. df['Edges_Shift'] = df['Steps'].shift(1)
RAW Paste Data
Top