Skip to content

Instantly share code, notes, and snippets.

@Ronald-TR
Created October 5, 2019 19:59
Show Gist options
  • Save Ronald-TR/5b03b3d28d3742cba9caa84a109ff21c to your computer and use it in GitHub Desktop.
Save Ronald-TR/5b03b3d28d3742cba9caa84a109ff21c to your computer and use it in GitHub Desktop.
dinos
import pandas as pd
from math import sqrt
GRAV_CONST = 9.8 # m/s^2
def calc_velocity(STRIDE_LENGTH, LEG_LENGTH, grav_const):
return ((STRIDE_LENGTH / LEG_LENGTH) - 1) * sqrt(LEG_LENGTH * grav_const)
dataset1 = pd.read_csv('dataset1.csv')
dataset2 = pd.read_csv('dataset2.csv')
DATASET = dataset1.merge(dataset2, on='NAME')
_filter = DATASET['STANCE']=='bipedal'
bipedals = DATASET[_filter]
results = []
for index, dino in bipedals.iterrows():
vel = calc_velocity(dino['STRIDE_LENGTH'], dino['LEG_LENGTH'], GRAV_CONST)
res = dict(dino)
res['vel'] = vel
results += [res]
results.sort(key=lambda x: x['vel'], reverse=True)
for dino in results:
print(dino['NAME'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment