Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit e38f5f9

Browse files
Update client.py
1 parent 7b5b20b commit e38f5f9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

labelpandas/client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ def create_data_rows_from_table(
4343
verbose : Required (bool) - If True, prints information about code execution
4444
divider : Optional (str) - String delimiter for all name keys generated
4545
Returns:
46-
List of errors from data row upload and a list of errors from table conversion - if either is successful, is an empty list
46+
A dictionary with "upload_results" and "conversion_errors" keys
47+
- "upload_results" key pertains to the results of the data row upload itself
48+
- "conversion_errors" key pertains to any errors related to data row conversion
4749
"""
4850

4951
# Ensure all your metadata_index keys are metadata fields in Labelbox and that your Pandas DataFrame has all the right columns
@@ -54,7 +56,7 @@ def create_data_rows_from_table(
5456

5557
# If df returns False, the sync failed - terminate the upload
5658
if type(df) == bool:
57-
return [], []
59+
return {"upload_results" : [], "conversion_errors" : []}
5860

5961
# Create a dictionary where {key=global_key : value=labelbox_upload_dictionary} - this is unique to Pandas
6062
global_key_to_upload_dict, conversion_errors = connector.create_upload_dict(
@@ -70,15 +72,15 @@ def create_data_rows_from_table(
7072
print(f'Data row upload will continue - the first return value will be data row upload results')
7173
else:
7274
print(f'Data row upload will not continue')
73-
return [], errors
75+
return {"upload_results" : [], "conversion_errors" : errors}
7476

7577
# Upload your data rows to Labelbox
7678
upload_results = self.base_client.batch_create_data_rows(
7779
dataset=lb_dataset, global_key_to_upload_dict=global_key_to_upload_dict,
7880
skip_duplicates=skip_duplicates, divider=divider, verbose=verbose
7981
)
8082

81-
return upload_results, conversion_errors
83+
return {"upload_results" : upload_results, "conversion_errors" : conversion_errors}
8284

8385
# def upsert_table_metadata():
8486
# return table

0 commit comments

Comments
 (0)