可见弃用警告Python

时间:2017-03-17 20:35:08

标签: python numpy integer

我正在尝试在python中为经济学论文和计算函数创建一个模型:

get-pip.py

我收到以下错误

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)

我尝试通过将exp函数中的值包含为np.int来解决此问题,但无济于事。有谁知道警告来自哪个变量?

1 个答案:

答案 0 :(得分:3)

看起来你错过了方括号内的int需要的地方:

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

将来,您可以使用warnings.filterwarnings('error')查找警告的确切回溯,这可以指向__getitem__

相关问题