当前位置:网站首页>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 ......
边栏推荐
- 监听对象中值变化及访问
- The series of hyperbolic function in daily problem
- Mysql Mac版下载安装教程
- Applet get user avatar and nickname
- 小程序获取用户头像和昵称
- C # webrequest post mode, based on "basic auth" password authentication mode, uploads files and submits other data using multipart / form data mode
- Yolov5 project based on QT
- Use of El tree search method
- 静态网页 和 动态网页的区别 & WEB1.0和WEB2.0的区别 & GET 和 POST 的区别
- Open Visual Studio 2010 hangs when opening a SQL file sql file
猜你喜欢

Nce detail of softmax approximation

900W+ 数据,从 17s 到 300ms,如何操作

FileZilla client download and installation

Nanning water leakage detection: warmly congratulate Guangxi Zhongshui on winning the first famous brand in Guangxi

FileZilla Client下載安裝

QQ小程序开发之 一些前期准备:预约开发账号、下载安装开发者工具、创建qq小程序
![Mongodb replication set [master-slave replication]](/img/2c/8030548455f45fa252062dd90e7b8b.png)
Mongodb replication set [master-slave replication]
![C programming learning notes [edited by Mr. Tan Haoqiang] (Chapter III sequence programming) 05 data input and output](/img/38/9c460fc58b62609dd02e7c61207ae6.jpg)
C programming learning notes [edited by Mr. Tan Haoqiang] (Chapter III sequence programming) 05 data input and output

ffmpeg下载安装教程及介绍
![Ansible introduction [unfinished (semi-finished products)]](/img/2a/0003daf761ba02d8837c4657fc3f29.png)
Ansible introduction [unfinished (semi-finished products)]
随机推荐
node,npm以及yarn下载安装
基于Qt的yolov5工程
Model transformation onnx2engine
Advanced redis applications [password protection, data persistence, master-slave synchronization, sentinel mode, transactions] [not completed yet (semi-finished products)]
Solve high and send system Currenttimemillis Caton
[mathematical logic] predicate logic (individual word | individual domain | predicate | full name quantifier | existence quantifier | predicate formula | exercise)
The file marked by labelme is converted to yolov5 format
idea 加载不了应用市场解决办法(亲测)
Limit of one question per day
[combinatorics] Application of exponential generating function (multiple set arrangement problem | different balls in different boxes | derivation of exponential generating function of odd / even sequ
45 lectures on MySQL [index]
C# WebRequest POST模式 ,基于“Basic Auth”口令认证模式,使用multipart/form-data方式上传文件及提交其他数据
Elsevier latex 提交文章 pdftex.def Error: File `thumbnails/cas-email.jpeg‘ not found: using draf
[AI practice] Application xgboost Xgbregressor builds air quality prediction model (I)
MySQL MAC download and installation tutorial
Pytorch配置
【PyG】理解MessagePassing过程,GCN demo详解
[set theory] partial order relation (partial order relation definition | partial order set definition | greater than or equal to relation | less than or equal to relation | integer division relation |
解决高并发下System.currentTimeMillis卡顿
How to make backgroundworker return an object