当前位置:网站首页>The difference between [x for X in list_a if not np.isnan (x)] and [x if not np.isnan (x) else none for X in list_a]
The difference between [x for X in list_a if not np.isnan (x)] and [x if not np.isnan (x) else none for X in list_a]
2022-07-27 14:07:00 【YKbsmn】
Create a list first :
list_a=[nan,1,2,3]1、x for x in list_a if not np.isnan(x)
list_a=[elem for elem in list_a if not np.isnan(elem)]
list_a
Equate to :
new_list=[]
for elem in list_a:
if not np.isnan(elem):
new_list.append(elem)
new_listThe result is :
[1, 1, 3]2、x if not np.isnan(x) else None for x in list_a
list_a=[elem if not np.isnan(elem) else None for elem in list_a ]
list_aEquate to :
new_list=[]
for elem in list_a:
if not np.isnan(elem):
new_list.append(elem)
else:
new_list.append(None)
new_listThe result is :
[None, 1, 1, 3]3、 summary :
For the case of the title , No matter if and for Which is in the front , It's all done first for, Re execution if!!
If there is a mistake , Please correct me. .
边栏推荐
- HDU4565 So Easy!【矩阵连乘】【推导】
- 井贤栋等蚂蚁集团高管不再担任阿里合伙人 确保独立决策
- What are the benefits of taking NPDP
- 基于C语言实现线性表的建立、插入、删除、查找等基本操作
- 灵活易用所见即所得的可视化报表
- Jing Xiandong and other senior executives of ant group no longer serve as Alibaba partners to ensure independent decision-making
- 在灯塔工厂点亮5G,宁德时代抢先探路中国智造
- [training day3] section [greed] [two points]
- 面向流行性疾病科普的用户问题理解与答案内容组织
- 微策生物IPO过会:年营收12.6亿 睿泓投资与耀合医药是股东
猜你喜欢

建议收藏,PMP应战篇(2)之易混淆知识点

利用C语言实现URL解析的基本方法之优秀

13. User web layer services (I)

The salary level of programmers in various countries is a little miserable

There is no need for semantic segmentation of annotation data! Eth & Leuven University proposed maskdistill, using transformer for unsupervised semantic segmentation, SOTA

微策生物IPO过会:年营收12.6亿 睿泓投资与耀合医药是股东

RSS tutorial: aggregate your own information collection channels, rshub, freshrss, NetNewsWire

基于预训练模型的多标签专利分类研究

Cultural tourism and data collection | travel to Yunnan in an artistic way
![[training day4] card game [greed]](/img/02/88af03ca5e137eba6cdd778f827f2b.png)
[training day4] card game [greed]
随机推荐
Motion attitude control system of DOF pan tilt based on stm32
基于招聘广告的岗位人才需求分析框架构建与实证研究
Cultural tourism and data collection | travel to Yunnan in an artistic way
Golang excellent open source project summary
文旅数藏 | 用艺术的方式游云南
Brief tutorial for soft exam system architecture designer | system design
[luogu_p4556] [Vani has an appointment] tail in rainy days / [template] segment tree merging
记账软件如何查看收入支出
West test Shenzhen Stock Exchange listing: annual revenue of 240million, fund-raising of 900million, market value of 4.7 billion
[training day3] delete [simulation]
Leetcode Tencent selected exercises 50 questions -059. Spiral matrix II
阻塞队列BlockingQueue
How to make computers have public IP
One of yolox improvements: add CBAM, Se, ECA attention mechanism
基于RoBERTa-wwm动态融合模型的中文电子病历命名实体识别
The finished product of wechat campus laundry applet graduation design (1) development outline
达科为生物IPO过会:年营收8.37亿 吴庆军父女为实控人
基于预训练模型的多标签专利分类研究
Wechat campus laundry applet graduation design finished product (4) opening report
GoPro access - control and preview GoPro according to GoPro official document /demo