简体   繁体   English

如何从numpy数组中删除None行?

[英]How to remove None rows from numpy array of arrays?

I have an array looking like this: 我有一个看起来像这样的数组:

[array([268.95504761,  -4.17598009, 404.12548828])
array([268.9979248 ,  -4.15205622, 404.09713745])
array([269.00808716,  -4.14346504, 404.07214355])
array([280.63632202,  -8.46781635, 398.50079346])
None 
None 
array([281.69018555,  -9.98347282, 390.9984436 ])]

How do I remove the None lines? 如何删除无行? All method I found assumed the regular case of a normal 2D array containing some None elements. 我发现的所有方法都假定包含2个None元素的普通2D数组的常规情况。

[elem for elem in my_list if elem is not None]

Simple list-comprehension? 简单的列表理解? Correct me if I misunderstood you :-) 如果我误会你的话纠正我:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM