Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matplotlib versions >=3 does not include a find()

I am running a very simple Python script:

from tftb.generators import amgauss, fmlin

I get this error:

C:\Users\Anaconda3\envs\tf_gpu\lib\site-packages\tftb-0.0.1-py3.6.egg\tftb\processing\affine.py in <module>
     12 
     13 import numpy as np
---> 14 from matplotlib.mlab import find
     15 from scipy.signal import hilbert
     16 from scipy.optimize import brenth, newton

ImportError: cannot import name 'find'

I believe find is no longer in versions >=3. How can I get around this without downgrading Matplotlib?

like image 714
Ivan Avatar asked Jul 19 '26 22:07

Ivan


1 Answers

The code of the matplotlib.mlab.find function was literally

import numpy as np

def find(condition):
    res, = np.nonzero(np.ravel(condition))
    return res

You may replace any occurance with that function.

like image 54
ImportanceOfBeingErnest Avatar answered Jul 21 '26 12:07

ImportanceOfBeingErnest