当前位置:网站首页>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 ......
边栏推荐
- ffmpeg录制屏幕和截屏
- About HTTP cache control
- [mathematical logic] predicate logic (individual word | individual domain | predicate | full name quantifier | existence quantifier | predicate formula | exercise)
- Small guide for rapid formation of manipulator (VIII): kinematic modeling (standard DH method)
- Hi3536c v100r001c02spc040 cross compiler installation
- VS 2019 配置tensorRT生成engine
- [Chongqing Guangdong education] cultural and natural heritage reference materials of China University of Geosciences (Wuhan)
- 900w+ data, from 17s to 300ms, how to operate
- Convert binary stream to byte array
- 使用InputFilter限制EditText时踩坑及解决方案
猜你喜欢

Application of derivative in daily question

900w+ data, from 17s to 300ms, how to operate
![C programming learning notes [edited by Mr. Tan Haoqiang] (Chapter III sequence programming) 03 operators and expressions](/img/4a/1df03d9f3315debb4c335260ed39f2.jpg)
C programming learning notes [edited by Mr. Tan Haoqiang] (Chapter III sequence programming) 03 operators and expressions

Introduction to mongodb

Captura下载安装及在Captura配置FFmpeg

Hi3536c v100r001c02spc040 cross compiler installation
![MySQL practice 45 lecture [row lock]](/img/71/344daddee537a96f0d38241e6896e1.png)
MySQL practice 45 lecture [row lock]

Summary of electromagnetic spectrum

Elsevier latex submitted the article pdftex def Error: File `thumbnails/cas-email. jpeg‘ not found: using draf

FileZilla client download and installation
随机推荐
Stepping on pits and solutions when using inputfilter to limit EditText
User value is the last word in the competition of mobile phone market
idea 加载不了应用市场解决办法(亲测)
MongoDB简介
解决高并发下System.currentTimeMillis卡顿
el-tree搜索方法使用
简易版 微信小程序开发之页面跳转、数据绑定、获取用户信息、获取用户位置信息
900W+ 数据,从 17s 到 300ms,如何操作
QT based tensorrt accelerated yolov5
Bid farewell to artificial mental retardation: Mengzi open source project team received RMB 100 million financing to help NLP develop
Yolov5 project based on QT
二进制流转换成字节数组
labelimg生成的xml文件转换为voc格式
Vs 2019 configure tensorrt to generate engine
Section 26 detailed explanation and demonstration of IPSec virtual private network configuration experiment - simulation experiment based on packettracer8.0
Réglez la hauteur et lancez le système. Currenttimemillis catton
Applet get user avatar and nickname
Avec trois. JS fait une scène 3D simple
redis高级应用【密码防护、数据持久化、主从同步、哨兵模式、事务】【暂未完成(半成品)】
FileZilla Client下載安裝