Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132922 views
License: OTHER
1
def compute_departure_timestamp(df):
2
hours = df.CRSDepTime // 100
3
hours_timedelta = pd.to_timedelta(hours, unit='h')
4
5
minutes = df.CRSDepTime % 100
6
minutes_timedelta = pd.to_timedelta(minutes, unit='m')
7
8
return df.Date + hours_timedelta + minutes_timedelta
9
10
departure_timestamp = df.map_partitions(compute_departure_timestamp)
11