The Taskframe Class: Exporting Labels - Taskframe/taskframe-python GitHub Wiki
Once your team has finished annotating your Tasks, you have a few options to export the results.
Quick Summary
# Assuming a finished Taskframe:
tf = Taskframe.retrieve("xxxx")
# export to a CSV:
tf.to_csv("local/path/results.csv")
# export to a Pandas Dataframe:
df = tf.to_dataframe()
# Include the resulting labels on a new column of an existing dataframe:
df_with_label_column = tf.merge_to_dataframe(df)
to_csv
Export your results as a CSV Signature:
def to_csv(self, path):
Parameters:
path
: local path where the CSV will be saved.
Returns: None
Example:
# Assuming a finished Taskframe:
tf = Taskframe.retrieve("xxxx")
tf.to_csv("local/path/results.csv")
to_dataframe
Generate a Pandas dataframe with the results. Signature:
def to_dataframe(self):
Parameters: None
Returns: A pandas DataFrame with the results.
Example:
# Assuming a finished Taskframe:
tf = Taskframe.retrieve("xxxx")
df = tf.to_dataframe()
merge_to_dataframe
If your input Dataset is a Dataframe, you can merge your result labels as a new column in your original Dataframe.
Requires that you had submitted custom_id
to be able to join rows.
Signature:
merge_to_dataframe(self, dataframe, custom_id_column):
Parameters:
dataframe
: the dataframe to which we will add a newlabels
columncustom_id_colum
: the name of the column containing unique identifiers (should be the same as provided when dataset was initially submitted)
Returns: a copy of the input dataframe with an extra label
column containing the results.
Example:
df = pd.DataFrame(...)
tf.add_dataset_from_dataframe(df)
tf.submit()
# Your workers annotate, once it's done:
df = pd.DataFrame(...)
df_with_labels = tf.merge_to_dataframe(df)