oTree Forum >

Importing Data?

#1 by wilson (edited )

I am thinking of importing data for a study that involves doing multiple rounds with data for each round. I am building the study in OTree Studio, and was wondering whether:

1) Pandas is okay to use
2) Should I use the internal reading CSV function, which may not be supported on OTree Studio
3) Go manual and hardcode lists/tuples with the specific values that I have at the participant level in the constants section of the app involving the multiple rounds; extract them out as desired.

Appreciate any advice!

#2 by Chris_oTree

oTree Studio doesn’t currently support file formats such as CSV. The workaround is to make a function that returns this data. Paste the CSV contents into a function, then put it in a multi line string with triple quotes. Then you can use pythons CSV DictReader to load this.

You don’t need to use Pandas for this. It adds extra dependencies that are not necessary.

#3 by wilson

Thanks Chris!

 I did a workaround for now by including the csv data as separate tuples in the constants section of the app that handles the multiple rounds (data for each round = 1 entry in the tuple).

Write a reply

Set forum username