entercaspa
entercaspa

Reputation: 704

Visible Deprecation Warning Python

I am trying to make a model in python for an economics dissertation and in calculating a function:

elif wage_online == max(wages):
            # after going to online you get the highest wage after cost of education
            learning_benefit = int(np.int((1 + gamma_online_learning) * x[0]) * exp(np.int(bivariate_distribution[x[0] - 1, x[1] - 1])))
            social_benefit = int(((1 + gamma_online_social) * np.int(x[1])) * exp(np.int(bivariate_distribution[x[0] - 1, x[1] - 1])))
            sigma_social.append(social_benefit)
            sigma_learning.append(learning_benefit)

I get the following error

/Users/sa/Documents/Dissertation/first_defiation.py:160: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  learning_benefit = int(np.int((1 + gamma_online_learning) * x[0]) * exp(np.int(bivariate_distribution[x[0] - 1, x[1] - 1])))

I tried to fix this by including the value in the exp function as np.int, but to no avail. does anyone know which variable the warning is coming from?

Upvotes: 2

Views: 1155

Answers (1)

Eric
Eric

Reputation: 97681

Looks like you missed the one place where int was needed, inside the square brackets:

social_benefit = (1 + gamma_online_social) * x[1] * exp(
    bivariate_distribution[int(x[0] - 1), int(x[1] - 1)]   # needed here for indexing
)

In future, you can use warnings.filterwarnings('error') to find the exact traceback of the warning, which would have pointed you to __getitem__

Upvotes: 4

Related Questions