Spaces:
Build error
Build error
File size: 1,269 Bytes
e2ddd5b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import pandas as pd
def generatehousecontrol(house):
housesteps = house[house['Type'] == 'Move']
step = housesteps.sample()['Move'].iloc[0]
steprhythm = house[house['Type'] == 'Rhythm'].sample()['Move'].iloc[0]
bounce = house[house['Type'] == 'Bounce'].sample()['Move'].iloc[0]
# upper body control
controltype = house[house['Type'].isin(['Micro Control','Macro Control'])].sample()['Type'].iloc[0]
labels = {'Step': step,
'Step Rhythm': f"{steprhythm}",
'Bounce': bounce}
if controltype == 'Micro Control':
body = house[(house['Type'] == 'Micro Control') & (house['Subtype'] == 'Body Region')].sample()['Move'].iloc[0]
direction = house[(house['Type'] == 'Micro Control') & (house['Subtype'] == 'Direction')].sample()['Move'].iloc[0]
labels['Body Direction'] = direction
elif controltype == 'Macro Control':
body = house[(house['Type'] == 'Macro Control')].sample()['Move'].iloc[0]
labels['Body'] = body
bodyrhythm = house[house['Type'] == 'Rhythm'].sample()['Move'].iloc[0]
labels['Body Rhythm'] = bodyrhythm
return labels
if __name__ == "__main__":
house = pd.read_csv('data/house_universe.csv')
print (generatehousecontrol(house))
|