当前位置:网站首页>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 ......
边栏推荐
- Use three JS make a simple 3D scene
- Applet get user avatar and nickname
- New programmers use the isXXX form to define Boolean types in the morning, and are discouraged in the afternoon?
- Stepping on pits and solutions when using inputfilter to limit EditText
- Vs Code configure virtual environment
- The calculation of stripe, kernel and padding in CNN
- Pat class B common function Usage Summary
- Vs 2019 configuration tensorrt
- softmax的近似之NCE详解
- Convert binary stream to byte array
猜你喜欢

Small guide for rapid formation of manipulator (VIII): kinematic modeling (standard DH method)
![[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)

ffmpeg录制屏幕和截屏

Idea set method call ignore case

900w+ data, from 17s to 300ms, how to operate

MongoDB安装 & 部署

Captura下载安装及在Captura配置FFmpeg
![MySQL practice 45 lecture [row lock]](/img/71/344daddee537a96f0d38241e6896e1.png)
MySQL practice 45 lecture [row lock]

MySQL MAC download and installation tutorial
![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
随机推荐
About HTTP cache control
为什么线程崩溃不会导致 JVM 崩溃
VS code配置虚拟环境
MongoDB简介
Tidal characteristics of the Bohai Sea and the Yellow Sea
Solve high and send system Currenttimemillis Caton
45 lectures on MySQL [index]
The idea setting code is in UTF-8 idea Properties configuration file Chinese garbled
The file marked by labelme is converted to yolov5 format
Compare float with 0
Agile certification (professional scrum Master) simulation exercises
Vs 2019 configure tensorrt to generate engine
程序员新人上午使用 isXxx 形式定义布尔类型,下午就被劝退?
[Chongqing Guangdong education] cultural and natural heritage reference materials of China University of Geosciences (Wuhan)
Download and install node, NPM and yarn
Don't use the new Dede collection without the updated Dede plug-in
[combinatorics] basic counting principle (addition principle | multiplication principle)
ffmpeg录制屏幕和截屏
【AI实战】应用xgboost.XGBRegressor搭建空气质量预测模型(一)
Hi3536c v100r001c02spc040 cross compiler installation