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))