import pandas as pd from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import pandas as pd import random author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'Rater' players_per_group = None num_rounds = 1 data = pd.read_csv("picdata.csv", delimiter=",", encoding = "latin1") df = pd.DataFrame(data, columns=['photoid', 'word']) class Subsession(BaseSubsession): def creating_session(self): if self.round_number == 1: for player in self.get_players(): list_of_fotos = Constants.df.sample(n=3) player.photoid_1 = list_of_fotos.iloc[0,0] player.word_1 = list_of_fotos.iloc[0,1] player.photoid_2 = list_of_fotos.iloc[1,0] player.word_2 = list_of_fotos.iloc[1,1] player.photoid_2 = list_of_fotos.iloc[2, 0] player.word_2 = list_of_fotos.iloc[2, 1] class Group(BaseGroup): pass class Player(BasePlayer): photoid_1 = models.StringField() photoid_2 = models.StringField() photoid_3 = models.StringField() word_1 = models.StringField() word_2 = models.StringField() word_3 = models.StringField()