Toloka documentation

get_assignments_df

toloka.client.TolokaClient.get_assignments_df | Source code

Downloads assignments as pandas.DataFrame.

Warning

Requires toloka-kit[pandas] extras. Install it with the following command:

pip install toloka-kit[pandas]

Experimental method. Implements the same behavior as if you download results in web-interface and then read it by pandas.

Parameters Description

Parameters Type Description
pool_id str

From which pool the results are loaded.

status Optional[List[GetAssignmentsTsvParameters.Status]]

Statuses of assignments to download.

start_time_from Optional[datetime]

Download assignments submitted after the specified date and time.

start_time_to Optional[datetime]

Download assignments submitted before the specified date and time.

exclude_banned Optional[bool]

Exclude answers from banned Tolokers, even if their assignments have suitable status.

field Optional[List[GetAssignmentsTsvParameters.Field]]

Names of Assignment fields to be downloaded. Fields other then from Assignment class are always downloaded.

  • Returns:

    DataFrame with all results. Contains groups of fields with prefixes:

  • "INPUT" - Fields that were at the input in the task.

  • "OUTPUT" - Fields that were received as a result of execution.

  • "GOLDEN" - Fields with correct answers. Filled in only for golden tasks and training tasks.

  • "HINT" - Hints for completing tasks. Filled in for training tasks.

  • "ACCEPT" - Fields describing the deferred acceptance of tasks.

  • "ASSIGNMENT" - fields describing additional information about the Assignment.

  • Return type:

    DataFrame

Examples:

Get all assignments from the specified pool by pool_id to pandas.DataFrame. And apply the native pandas rename method to change columns' names.

answers_df = toloka_client.get_assignments_df(pool_id='1')
answers_df = answers_df.rename(columns={
    'INPUT:image': 'task',
    'OUTPUT:result': 'label',
    'ASSIGNMENT:worker_id': 'annotator'
})