当前位置:网站首页>Numpy warning visibledeprecationwarning: creating an ndarray from ragged needed sequences
Numpy warning visibledeprecationwarning: creating an ndarray from ragged needed sequences
2022-07-03 03:28:00 【Water W】
Catalog
Warning
This is what I wrote read npz File code ,
datas = np.load("bsm.npz", allow_pickle=True)
print(datas.files)
for key, arr in datas.items():
print(key, ": ", arr)After executing the code , Can output the expected results , But also got a warning , as follows :
VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
val = np.asanyarray(val)
solve
In fact, this is not a mistake , Just the new version numpy A warning from , You can ignore . Of course, it always affects the beauty , You can turn off the warning directly .
This is because of the new numpy edition , take Create lists or tuples of different lengths or shapes or ndarray A list or ndarray Functions of tuples Will be discarded , Although it can run , But always prompt Warning Still very uncomfortable , Besides, you can't use it like this anymore .
Try the solution of network transmission :
- Use earlier numpy edition
- add to dtype=object
- Add a line of ignore error code
(1) Try it. There is a saying on the Internet that is to add “dtype=object”,
# 3. Load data
datas = np.load("bsm.npz", allow_pickle=True, dtype=object)
print(datas.files)
for key, arr in datas.items():
print(key, ": ", arr)
But it's still wrong , I won't even output the results ,

(2) Let's try another saying on the Internet :numpy Version of is too high , Need to reduce numpy Version of .
Check your own numpy Version of , I am now numpy The version is 1.23.0,

ok , Let's reinstall the lower version numpy try ,

Waiting for the installation to complete , Wrong report ,

ok .
(3) I also saw a saying on the Internet :
np.warnings.filterwarnings('ignore', category=np.VisibleDeprecationWarning)
or
np.warnings.filterwarnings('error', category=np.VisibleDeprecationWarning)Let's try ,

It doesn't seem to work ......
(4) Finally, I decided to ignore it ......
边栏推荐
- Introduction à mongodb
- VS 2019 配置tensorRT生成engine
- The series of hyperbolic function in daily problem
- Summary of electromagnetic spectrum
- Idea set method call ignore case
- labelme标记的文件转换为yolov5格式
- PAT乙级常用函数用法总结
- MongoDB复制集【主从复制】
- 2020-01-01t00:00:00.000000z date format conversion
- Summary of matrix knowledge points in Chapter 2 of Linear Algebra (Jeff's self perception)
猜你喜欢

ffmpeg之 一张/多张图片合成视频

umi 路由拦截(简单粗暴)
![[MySQL] the difference between left join, right join and join](/img/d4/8684cd59cd1bd77e70bd4d7c7074c3.jpg)
[MySQL] the difference between left join, right join and join

The series of hyperbolic function in daily problem

Téléchargement et installation du client Filezilla

Use three JS make a simple 3D scene

QQ小程序开发之 一些前期准备:预约开发账号、下载安装开发者工具、创建qq小程序

docker安装及启动mysql服务

Small guide for rapid formation of manipulator (VIII): kinematic modeling (standard DH method)
![[pyg] understand the messagepassing process, GCN demo details](/img/8b/8490aac98fd2753e661f74e284f43d.png)
[pyg] understand the messagepassing process, GCN demo details
随机推荐
Convert binary stream to byte array
Vs 2019 installation and configuration opencv
labelme标记的文件转换为yolov5格式
User value is the last word in the competition of mobile phone market
Limit of one question per day
Pat class B common function Usage Summary
Idea set method call ignore case
用Three.js做一个简单的3D场景
el-tree搜索方法使用
QQ小程序开发之 一些前期准备:预约开发账号、下载安装开发者工具、创建qq小程序
Section 26 detailed explanation and demonstration of IPSec virtual private network configuration experiment - simulation experiment based on packettracer8.0
The file marked by labelme is converted to yolov5 format
float与0比较
MongoDB基本操作【增、删、改、查】
New programmers use the isXXX form to define Boolean types in the morning, and are discouraged in the afternoon?
MySQL MAC download and installation tutorial
VS 2019安装及配置opencv
Download and install node, NPM and yarn
简易版 微信小程序开发之页面跳转、数据绑定、获取用户信息、获取用户位置信息
Find the storage address of the elements in the two-dimensional array