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

Commit 53cdabe

Browse files
Update data_rows.py
1 parent a201889 commit 53cdabe

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

labelpandas/data_rows.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
from tqdm import tqdm
66
from concurrent.futures import ThreadPoolExecutor, as_completed
77

8-
def create_data_row_upload_dict(client:labelboxClient, table:dict,
8+
def create_data_row_upload_dict(table:dict,
99
row_data_col:str, global_key_col:str, external_id_col:str, dataset_id_col:str,
1010
dataset_id:str, metadata_index:dict, attachment_index:dict,
1111
divider:str, verbose:bool, extra_client:bool=None):
1212
""" Multithreads over a Pandas DataFrame, calling create_data_rows() on each row to return an upload dictionary
1313
Args:
14-
client : Required (labelbox.client.Client) - Labelbox Client object
1514
table : Required (dict) - Pandas DataFrame as dict with df.to_dict("records")
1615
row_data_col : Required (str) - Column containing asset URL or raw text
1716
global_key_col : Required (str) - Column name containing the data row global key - defaults to row data
@@ -47,7 +46,7 @@ def create_data_row_upload_dict(client:labelboxClient, table:dict,
4746
print(f'Submitting data rows...')
4847
for index, row_dict in tqdm(df_dict):
4948
futures.append(exc.submit(
50-
create_data_rows, client, row_dict, metadata_name_key_to_schema, metadata_schema_to_name_key,
49+
create_data_rows, row_dict, metadata_name_key_to_schema, metadata_schema_to_name_key,
5150
row_data_col, global_key_col, external_id_col, dataset_id_col,
5251
dataset_id, metadata_index, attachment_index, divider
5352
))
@@ -64,7 +63,7 @@ def create_data_row_upload_dict(client:labelboxClient, table:dict,
6463
else:
6564
for index, row in table.iterrows():
6665
futures.append(exc.submit(
67-
create_data_rows, client, row_dict, metadata_name_key_to_schema, metadata_schema_to_name_key,
66+
create_data_rows, row_dict, metadata_name_key_to_schema, metadata_schema_to_name_key,
6867
row_data_col, global_key_col, external_id_col, dataset_id_col,
6968
dataset_id, metadata_index, attachment_index, divider
7069
))
@@ -81,14 +80,13 @@ def create_data_row_upload_dict(client:labelboxClient, table:dict,
8180
print(f'Generated upload list')
8281
return global_key_to_upload_dict, errors
8382

84-
def create_data_rows(client:labelboxClient, row_dict:dict,
83+
def create_data_rows(row_dict:dict,
8584
metadata_name_key_to_schema:dict, metadata_schema_to_name_key:dict,
8685
row_data_col:str, global_key_col:str, external_id_col:str, dataset_id_col:str,
8786
metadata_index:str, metadata_index:dict, attachment_index:dict,
8887
divider:str):
8988
""" Function to-be-multithreaded to create data row dictionaries from a Pandas DataFrame
9089
Args:
91-
client : Required (labelbox.client.Client) - Labelbox Client object
9290
row_dict : Required (dict) - Dictionary where {key=column_name : value=row_value}
9391
metadata_name_key_to_schema : Required (dict) - Dictionary where {key=metadata_field_name_key : value=metadata_schema_id}
9492
metadata_schema_to_name_key : Required (dict) - Inverse of metadata_name_key_to_schema

0 commit comments

Comments
 (0)