DataFlowAnalysis object does not have op_MAKE_FUNCTION attribute in Numba

I have not seen this particular scenario in my research for this error in Numba. This is my first time using the package so that it can be something obvious.

I have a function that calculates the engineering functions in a data set by adding, multiplying and / or dividing each column in a dataframe called data, and I wanted to check if numba would speed it up

@jit
def engineer_features(engineer_type,features,joined):
    #choose which features to engineer (must be > 1)
    engineered = features

    if len(engineered) > 1:
        if 'Square' in engineer_type:
            sq = data[features].apply(np.square)
            sq.columns = map(lambda s:s + '_^2',features)

        for c1,c2 in combinations(engineered,2):
            if 'Add' in engineer_type:
                data['{0}+{1}'.format(c1,c2)] = data[c1] + data[c2]
            if 'Multiply' in engineer_type:
                data['{0}*{1}'.format(c1,c2)] = data[c1] * data[c2]
            if 'Divide' in engineer_type:
                data['{0}/{1}'.format(c1,c2)] = data[c1] / data[c2]

        if 'Square' in engineer_type and len(sq) > 0:
            data= pd.merge(data,sq,left_index=True,right_index=True)

        return data

When I call it with a list of functions, engineer_type and a dataset:

engineer_type = ['Square','Add','Multiply','Divide']   

df = engineer_features(engineer_type,features,joined)

I get an error: Failed at object The DataFlowAnalysis object does not have the attribute 'op_MAKE_FUNCTION'

+4
source share
2 answers

. , -, numba .

+2

. Numba pandas. pandas df , @JIT. , , pandas df, .

0

Source: https://habr.com/ru/post/1665757/


All Articles