AttributeError: module ‘numpy‘ has no attribute ‘asscalar‘

使用rasterstast包统计栅格,报错:AttributeError: module 'numpy' has no attribute 'asscalar'

原因:NumPy 1.16.0 后就没有asscalar函数了

New deprecations
The type dictionaries numpy.core.typeNA and numpy.core.sctypeNA are deprecated. They were buggy and not documented and will be removed in the 1.18 release. Use`numpy.sctypeDict` instead.

The numpy.asscalar function is deprecated. It is an alias to the more powerful numpy.ndarray.item, not tested, and fails for scalars.

The numpy.set_array_ops and numpy.get_array_ops functions are deprecated. As part of NEP 15, they have been deprecated along with the C-API functions PyArray_SetNumericOps and PyArray_GetNumericOps. Users who wish to override the inner loop functions in built-in ufuncs should use PyUFunc_ReplaceLoopBySignature.

The numpy.unravel_index keyword argument dims is deprecated, use shape instead.

The numpy.histogram normed argument is deprecated. It was deprecated previously, but no warning was issued.

The positive operator (+) applied to non-numerical arrays is deprecated. See below for details.

Passing an iterator to the stack functions is deprecated

使用numpy.ndarray.item()代替asscalar()

参考:NumPy 1.16.0 Release Notes — NumPy v1.24.dev0 Manual

  • 7
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值