Skip to content

Instantly share code, notes, and snippets.

@lmeulen
Created April 4, 2021 11:20
Show Gist options
  • Save lmeulen/95ac21c86604b947eb5fe24417f0ca53 to your computer and use it in GitHub Desktop.
Save lmeulen/95ac21c86604b947eb5fe24417f0ca53 to your computer and use it in GitHub Desktop.
crowdedness_combine_trip_crowds
timedata = timedata.merge(druktedata[['ritnumber', 'departure',
'classification', 'seats', 'operator']],
left_on=['ritnumber', 'stop_code'],
right_on=['ritnumber', 'departure'])
timedata.time = timedata.time.apply(lambda x: min2str(x))
timedata['passengers'] = ((timedata.classification - 1) *
timedata.seats * 0.33).astype(int)
timedata['timestamp'] = (pd.to_datetime(timedata['time']) -
pd.Timestamp("1970-01-01")) // pd.Timedelta('1s')
timedata['elevation'] = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment