You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-5Lines changed: 13 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,12 +15,12 @@ pip install ztree2python
15
15
Alternatively, simply put ztree2python.py and a z-Tree data file (e.g., 221215_1449.xls) in the current directory or the working directory.
16
16
17
17
## Usage
18
-
The ztree2python is a simple function that takes the filename of a z-Tree data file as the argument and returns a dictionary that contains all of the tables in the z-Tree.
18
+
The ztree2python is a simple function that takes the filename of a z-Tree data file as the argument and returns a dictionary that contains all of the tables in the z-Tree data file.
19
19
```python
20
-
from ztree2python import ztree2python asztree2python
20
+
from ztree2python import ztree2python asz2p
21
21
22
22
# input the file name, and it returns a dictionary.
23
-
tables =ztree2python('221215_1449.xls')
23
+
tables =z2p('221215_1449.xls')
24
24
```
25
25
The function returns a dictionary. Each table is stored as a dataframe in the ```tables```. Get the data of a table as follows:
26
26
```python
@@ -39,19 +39,27 @@ for name, tbl in tables.items():
39
39
display(tbl)
40
40
```
41
41
42
+
## Technical notes
43
+
44
+
The function reads the data and iterates the following process over the names of the tables. It filters the rows of the main dataframe to only include rows that belong to the current table. Then it processes the data for each treatment within the table and creates a dataframe for each treatment.
45
+
If the period is repeated in the treatment, the data for the treatment has a header row with variable names inserted each period. This function assumes that these header rows are the same within the treatment and reads the top header row as the variable names, then removes all header rows afterwards. All data will be converted to numeric, if possible. Finally, the table for the current treatment is added to the dataframe for the current table.
46
+
47
+
After all the tables have been processed, the function returns the dictionary of dataframes.
48
+
42
49
## License
43
50
44
-
[MIT](https://choosealicense.com/licenses/mit/)
51
+
[MIT](https://choosealicense.com/licenses/mit/). ztree2python is "provided "as is", without warranty of any kind."
45
52
46
53
## Reference
47
54
Fischbacher, U. (2007). z-Tree: Zurich toolbox for ready-made economic experiments. *Experimental Economics*, 10(2), 171-178.
0 commit comments