|
|
@@ -0,0 +1,19 @@
|
|
|
+import pandas as pd
|
|
|
+import numpy as np
|
|
|
+import datetime
|
|
|
+import json
|
|
|
+import os
|
|
|
+
|
|
|
+cols2drop = [ 'hasImages', 'maxLapAvgRunCadence', 'groupRideUUID', 'avgJumpRopeCadence',
|
|
|
+ 'maxJumpRopeCadence', 'curatedCourseId', 'matchedCuratedCourseId',
|
|
|
+ 'startzeit', 'moderateIntensityMinutes', 'vigorousIntensityMinutes',
|
|
|
+ 'month', 'year' ]
|
|
|
+
|
|
|
+def mtb_table(df) :
|
|
|
+ df = df.reset_index().drop('index', axis=1, errors='ignore')
|
|
|
+ df['month'] = df['startTimeLocal'].dt.month
|
|
|
+ df['year'] = df['startTimeLocal'].dt.year
|
|
|
+ df['movingDuration'] = df['movingDuration'].map(lambda x: round(x/3600,2))
|
|
|
+ df.drop( cols2drop , axis=1, inplace=True ) # drop unnecessary columns
|
|
|
+ df = df.sort_values('startTimeLocal', ascending=[False])
|
|
|
+ return df
|