Skip to content
Advertisement

How to call synchronous function(s) from async functions in safe manner

What can occur if one or more workers call ‘Synchronous function’ simultaneously ? Maybe one or more workers become blocked for a while ? Answer Short answer: If you call a synchronous (blocking) function from within an async coroutine, all the tasks that are concurrently running in the loop will stall until this function returns. Use loop.run_in_executor(…) to asynchronous run

I get error , cannot import from file helper

Please help, I get the error below running jupyter notebook. Error: Answer Since you are not giving the where you get the notebook, I have to guess that you get it from this course Supervised Learning: Regression provided IBM. In the zip folder in week 1, it provides helper.py. What you need to do it is to change the directory

Cufflinks shows blank

I tried importing the financial data and use the following code. It runs fine but plotly just show blank canvas. I narrowed down and found out that the problem is cufflink because iplot alone (not using with dataframe still work fine) enter image description here Answer I think the graph did not show up because the name of the multi-index

3D numpy array threshold comparison

I’m trying to solve whether or not each element in a 3d numpy array fits within a certain threshold. Currently I have nested for loops that get the job done, but it’s really slow and I don’t have all day to wait for my code to run LOL. The input spec is a little bit weird so I haven’t been

Advertisement