I have an API call that I'm accessing via Python's multiprocessing map. In one of the rows, it's throwing a JSON decoding error but I can't figure out which row. How can I print the index the mapper is working on?
I would like to figure out either which count/index the multiprocess is working on that throws the error or which dataframe row.
def function(a):
rv = requests.post(
"url",
data=json.dumps(literal_eval(a)),
headers={"Content-Type": "application/json"},
)
proba_json = rv.json()
proba = (proba_json['data']['proba'])
return proba
with mlt.Pool(4) as p:
df["new_column"] = (p.map(function, df.column))
question from:
https://stackoverflow.com/questions/65859624/how-to-figure-out-which-index-of-python-multiprocessing-function-is-throwing-an 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…