Skip to content

Instantly share code, notes, and snippets.

@dottyz
Created May 2, 2019 18:34
Show Gist options
  • Save dottyz/887e773f7a882210ae32f8d36bdf22f5 to your computer and use it in GitHub Desktop.
Save dottyz/887e773f7a882210ae32f8d36bdf22f5 to your computer and use it in GitHub Desktop.
# Removing false start trips
df = df[(df['trip_duration_seconds']>=60)]
# Removing outliers
q1 = df['trip_duration_seconds'].quantile(0.25)
q3 = df['trip_duration_seconds'].quantile(0.75)
interquartile_range = q3 - q1
df = df[~((df['trip_duration_seconds'] < (q1 - 1.5 * interquartile_range)) \
|(df['trip_duration_seconds'] > (q3 + 1.5 * interquartile_range)))].reset_index(drop=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment