After executing this code I dont get any error, but how to print the Dictionary variable after the multiprocessing is done. df_Store is a dataframe that contains 3 columns - StoreID, Latitude, Longitude. After doing this is the error that I get-BrokenPipeError: [Errno 32] Broken pipe
df_Store = pd.read_parquet(r'C:\Users\Store_Table .parquet',engine = 'auto', columns=None )
Lat_ary = df_Store['Latitude'].tolist()
Long_ary = df_Store['Longitude'].tolist()
col = list(zip(Lat_ary,Long_ary ))
df_Store['Lat_Long']= col
from haversine import haversine
import multiprocessing
import time
start = time.perf_counter()
def proximity_store(d, df_Store):
d={};
for i in range(len(df_Store)):
for j in range(len(df_Store)):
if df_Store.StoreID[i]==df_Store.StoreID[j]:
pass
else:
haversine(df_Store.Lat_Long[i], df_Store.Lat_Long[j])
d[df_Store.StoreID[i],df_Store.StoreID[j]] = haversine
return d
if __name__ == '__main__':
d = multiprocessing.Manager().dict()
p1 = multiprocessing.Process(target=proximity_store, args=[d, df_Store])
p1.start()
p1.join()
finish=time.perf_counter()
print(f'Finished in {round(finish-start,2)}second(s)')
print(d)