当前位置:网站首页>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 ......
边栏推荐
- Bid farewell to artificial mental retardation: Mengzi open source project team received RMB 100 million financing to help NLP develop
- Download and install node, NPM and yarn
- PHP generates PDF tcpdf
- Mysql Mac版下载安装教程
- The idea setting code is in UTF-8 idea Properties configuration file Chinese garbled
- Idea format code idea set shortcut key format code
- The idea cannot be loaded, and the market solution can be applied (pro test)
- New programmers use the isXXX form to define Boolean types in the morning, and are discouraged in the afternoon?
- Lvgl usage experience
- 别再用 System.currentTimeMillis() 统计耗时了,太 Low,StopWatch 好用到爆!
猜你喜欢

numpy之 警告VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences

Limit of one question per day

The calculation of stripe, kernel and padding in CNN

Summary of matrix knowledge points in Chapter 2 of Linear Algebra (Jeff's self perception)

900w+ data, from 17s to 300ms, how to operate
![45 lectures on MySQL [index]](/img/f6/70be00028908cbd9ed7f2c77687cee.png)
45 lectures on MySQL [index]
![MySQL Real combat 45 [SQL query and Update Execution Process]](/img/cd/3a635f0c3bb4ac3c8241cb77285cc8.png)
MySQL Real combat 45 [SQL query and Update Execution Process]

Mongodb installation & Deployment

ffmpeg录制屏幕和截屏

Pytorch配置
随机推荐
@Accessors注解作用指定前缀遵守驼峰命名
Converts a timestamp to a time in the specified format
MySQL practice 45 [global lock and table lock]
Yolov5 project based on QT
Vs Code configure virtual environment
PAT乙级“1104 天长地久”DFS优化思路
Small guide for rapid formation of manipulator (VIII): kinematic modeling (standard DH method)
Idea set method call ignore case
Convert binary stream to byte array
[pyg] understand the messagepassing process, GCN demo details
Summary of matrix knowledge points in Chapter 2 of Linear Algebra (Jeff's self perception)
用Three.js做一個簡單的3D場景
FileZilla Client下载安装
Bigvision code
Pytoch lightweight visualization tool wandb (local)
机械臂速成小指南(八):运动学建模(标准DH法)
The idea cannot be loaded, and the market solution can be applied (pro test)
二进制流转换成字节数组
Lvgl usage experience
VS 2019安装及配置opencv