当前位置:网站首页>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 ......
边栏推荐
- File rename
- 为什么线程崩溃不会导致 JVM 崩溃
- Applet get user avatar and nickname
- The idea setting code is in UTF-8 idea Properties configuration file Chinese garbled
- Small guide for rapid formation of manipulator (VIII): kinematic modeling (standard DH method)
- 别再用 System.currentTimeMillis() 统计耗时了,太 Low,StopWatch 好用到爆!
- 900w+ data, from 17s to 300ms, how to operate
- PHP generates PDF tcpdf
- MySQL Real combat 45 [SQL query and Update Execution Process]
- FileZilla client download and installation
猜你喜欢
![MySQL practice 45 [SQL query and update execution process]](/img/cd/3a635f0c3bb4ac3c8241cb77285cc8.png)
MySQL practice 45 [SQL query and update execution process]

Limit of one question per day

Summary of matrix knowledge points in Chapter 2 of Linear Algebra (Jeff's self perception)
![MySQL practice 45 lecture [transaction isolation]](/img/a5/5420651d6be51e892976f02be8c43c.png)
MySQL practice 45 lecture [transaction isolation]
![[Chongqing Guangdong education] cultural and natural heritage reference materials of China University of Geosciences (Wuhan)](/img/19/815e7cba81f6eb52db5ef0db556dfd.jpg)
[Chongqing Guangdong education] cultural and natural heritage reference materials of China University of Geosciences (Wuhan)

The idea cannot be loaded, and the market solution can be applied (pro test)

Small guide for rapid formation of manipulator (VIII): kinematic modeling (standard DH method)

机械臂速成小指南(八):运动学建模(标准DH法)

Vs 2019 installation and configuration opencv

小程序获取用户头像和昵称
随机推荐
The series of hyperbolic function in daily problem
ffmpeg下载安装教程及介绍
docker安装及启动mysql服务
为什么线程崩溃不会导致 JVM 崩溃
Don't use the new Dede collection without the updated Dede plug-in
Mongodb installation & Deployment
Mongodb master profile
[mathematical logic] normal form (conjunctive normal form | disjunctive normal form | major item | minor item | maximal item | minor item | principal conjunctive normal form | principal disjunctive no
MongoDB簡介
FileZilla client download and installation
Elsevier latex 提交文章 pdftex.def Error: File `thumbnails/cas-email.jpeg‘ not found: using draf
MySQL practice 45 [SQL query and update execution process]
Application of derivative in daily question
Nanning water leakage detection: warmly congratulate Guangxi Zhongshui on winning the first famous brand in Guangxi
Latest version of NPM: the "NPM" item cannot be recognized as the name of a cmdlet, function, script file, or runnable program. Please check
MySQL practice 45 lecture [transaction isolation]
二进制流转换成字节数组
Agile certification (professional scrum Master) simulation exercise-2
Agile certification (professional scrum Master) simulation exercises
[combinatorics] number of solutions of indefinite equations (number of combinations of multiple sets R | number of non negative integer solutions of indefinite equations | number of integer solutions