Created
February 9, 2020 13:43
-
-
Save WouterNieuwerth/951c3c410dedd551c6a1782a93aca5d3 to your computer and use it in GitHub Desktop.
GPX analysis - step 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a column with values that are 'shifted' one forwards, so we can create calculations for differences. | |
df['lon-start'] = df['lon'] | |
df['lon-start'].iloc[-1] = np.nan | |
df['lon-start'] = np.roll(df['lon-start'], 1) | |
df['lat-start'] = df['lat'] | |
df['lat-start'].iloc[-1] = np.nan | |
df['lat-start'] = np.roll(df['lat-start'], 1) | |
df['alt-start'] = df['alt'] | |
df['alt-start'].iloc[-1] = np.nan | |
df['alt-start'] = np.roll(df['alt-start'], 1) | |
df['time-start'] = df['time'] | |
df['time-start'].iloc[-1] = np.nan | |
df['time-start'] = np.roll(df['time-start'], 1) | |
df = df.fillna(method='bfill') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment