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

Commit 353f4cb

Browse files
Update connector.py
1 parent 716c1a5 commit 353f4cb

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

labelpandas/connector.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import pandas
44
from concurrent.futures import ThreadPoolExecutor, as_completed
55
from tqdm import tqdm
6+
import math
67

78
def create_upload_dict(df:pandas.core.frame.DataFrame, lb_client:Client, base_client:baseClient, row_data_col:str,
89
global_key_col:str="", external_id_col:str="", metadata_index:dict={}, local_files:bool=False, divider:str="///", verbose=False):
@@ -36,15 +37,15 @@ def create_upload_dict(df:pandas.core.frame.DataFrame, lb_client:Client, base_cl
3637
for index, row in df.iterrows():
3738
futures.append(exc.submit(create_data_rows, lb_client, base_client, row, metadata_name_key_to_schema, metadata_schema_to_name_key, row_data_col, global_key_col, external_id_col, metadata_index, local_files, divider))
3839
if verbose:
39-
print(f'Processing data rows...')
40-
if verbose:
41-
for f in tqdm(list(as_completed(futures))):
42-
res = f.result()
43-
global_key_to_upload_dict[str(res["global_key"])] = res
44-
else:
45-
for f in as_completed(futures):
46-
res = f.result()
47-
global_key_to_upload_dict[str(res["global_key"])] = res
40+
print(f'Processing data rows...')
41+
for f in as_completed(futures):
42+
res = f.result()
43+
global_key_to_upload_dict[str(res["global_key"])] = res
44+
if verbose:
45+
x += 1
46+
percent_complete = math.ceil((x / len(df)*100))
47+
if 100%percent_complete == 0:
48+
print(f'{str(percent_complete)}% complete
4849
if verbose:
4950
print(f'Generated upload list - {len(global_key_to_upload_dict)} data rows to upload')
5051
return global_key_to_upload_dict

0 commit comments

Comments
 (0)