当前位置:网站首页>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 ......
边栏推荐
- [combinatorics] Application of exponential generating function (multiple set arrangement problem | different balls in different boxes | derivation of exponential generating function of odd / even sequ
- Limit of one question per day
- Vs 2019 installation and configuration opencv
- QQ小程序开发之 一些前期准备:预约开发账号、下载安装开发者工具、创建qq小程序
- Open Visual Studio 2010 hangs when opening a SQL file sql file
- [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
- Change and access of median value of listening object
- Ansible introduction [unfinished (semi-finished products)]
- 渤、黄海的潮汐特征
- PAT乙级常用函数用法总结
猜你喜欢
[pyg] understand the messagepassing process, GCN demo details
Vs 2019 configure tensorrt to generate engine
Use three JS make a simple 3D scene
Hi3536c v100r001c02spc040 cross compiler installation
The idea setting code is in UTF-8 idea Properties configuration file Chinese garbled
VS 2019配置tensorRT
MongoDB簡介
Applet get user avatar and nickname
MySQL practice 45 lecture [row lock]
Ansible introduction [unfinished (semi-finished products)]
随机推荐
Avec trois. JS fait une scène 3D simple
MySQL practice 45 lecture [transaction isolation]
Ansible简介【暂未完成(半成品)】
Agile certification (professional scrum Master) simulation exercises
Application of derivative in daily question
Find the storage address of the elements in the two-dimensional array
File rename
Compare float with 0
Téléchargement et installation du client Filezilla
MongoDB基本操作【增、删、改、查】
labelme标记的文件转换为yolov5格式
Nce detail of softmax approximation
Pytoch configuration
C programming learning notes [edited by Mr. Tan Haoqiang] (Chapter III sequence programming) 03 operators and expressions
将时间戳转为指定格式的时间
Pytorch multi card distributed training distributeddataparallel usage
Idea set method call ignore case
模型转换onnx2engine
Using jasmine to monitor constructors - spying on a constructor using Jasmine
MySQL practice 45 [SQL query and update execution process]