当前位置:网站首页>None和nan、NaN、NAN
None和nan、NaN、NAN
2022-07-23 22:51:00 【MallocLu】
总结
None是Python中表示空数据的对象,nan、NaN、NAN是numpy中表示空数据的对象(其中pandas读取Excel时空数据使用的是nan)
# nan、NaN、NAN的判断
isnan(t)
t != t
# None的判断
isinstance(t, type(None))
not t
测试
from math import isnan
from numpy import nan, NaN, NAN
# True True True
print(isnan(nan), isnan(NaN), isnan(NAN))
# TypeError: must be real number, not NoneType
print(isnan(None))
# <class 'float'> <class 'float'> <class 'float'>
print(type(nan), type(NaN), type(NAN))
# <class 'NoneType'>
print(type(None))
# False False False
print(nan == nan, NaN == NaN, NAN == NAN)
# True
print(None == None)
# 不满足
if not nan:
print('nan')
# 满足
if not None:
print('None')
# True True True
print(id(nan) == id(nan), id(NaN) == id(NaN), id(NAN) == id(NAN))
# True
print(id(None) == id(None))
边栏推荐
- STM32单片机使用ADC功能驱动手指检测心跳模块
- 记忆化搜索 - DP
- The font of Siyuan notes is thinner and lighter than that in other editors (atom, VSC, sublime)
- 121. The best time to buy and sell stocks
- SOLIDWORK learning notes: Sketch geometric relationships and editing
- Array -- 209. Subarray with the smallest length
- FL Studio 20.9 update Chinese version host Daw digital audio workstation
- TAP 系列文章6 | TAP的应用模型
- Build your own target detection environment, model configuration, data configuration mmdetection
- 除了钱,创业者还需要什么?专访明月湖创赛创投机构
猜你喜欢

How ZK solves the problem of cerebral fissure
![Use of [golang learning notes] package](/img/be/71cb066f44ce4bdab13c79c2da2652.png)
Use of [golang learning notes] package

Raspberry pie SSH login

Stm32+esp8266+mqtt protocol connects Alibaba cloud Internet of things platform

fl studio 20.9更新中文版宿主DAW数字音频工作站

Ways to improve the utilization of openeuler resources 01: Introduction

Microsoft SQL Server database language and function usage (XIII)

Remember an experience of being cheated by the Internet

SOLIDWORK learning notes: Sketch geometric relationships and editing

Tap series article 4 | backstage based tap developer portal
随机推荐
巴菲特股东大会的启示 2021-05-06
Diabetes genetic risk testing challenge advanced
Array -- 27. remove elements
STM32+ESP8266+MQTT协议连接阿里云物联网平台
接口测试
unity visual studio2019升级到2022版本(扔掉盗版红渣)
At the forefront of the times, Huawei aims at the wind and sea of digital finance
Notes on network segment CIDR
Crazy bull market, where to go in the second half? 2021-04-30
[unity3d daily bug] unity3d solves "the type or namespace name" XXX "cannot be found (are you missing the using directive or assembly reference?)" Etc
Drools (1): introduction to drools
Relevant interfaces of [asp.net core] option mode
Raspberry pie SSH login
Data sorting and usage before torchvision.datasets.imagefolder
ES6箭头函数的使用
13. Roman to integer
[jailhouse article] a novel software architecture for mixed criticality systems (2020)
Interface test
ES6 use of arrow function
Can Verilog of synthetizable be integrated