Skip to content

Instantly share code, notes, and snippets.

@LosantGists
Created July 23, 2021 19:25
Show Gist options
  • Select an option

  • Save LosantGists/7ebcf864ec3590246d08828e4859f60a to your computer and use it in GitHub Desktop.

Select an option

Save LosantGists/7ebcf864ec3590246d08828e4859f60a to your computer and use it in GitHub Desktop.
Automating Unit Tests Blog (8) 7.23.21
def get_rows_before_charging(df):
df['battery_loss_next_row'] = df['battery'] - df['battery'].shift(-1)
df['is_low_before_charge'] = df['battery_loss_next_row'] < 0
return df[df['is_low_before_charge']]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment