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

Question:

I am running a very simple Python script:

from tftb.generators import amgauss, fmlin

I get this error:

C:UsersAnaconda3envstf_gpulibsite-packagestftb-0.0.1-py3.6.eggtftbprocessingaffine.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?

Asked By: Ivan

||

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.

Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.