Phao có thể là NaN Python không?

Cách đây không lâu, chúng tôi thậm chí đã cải thiện tài liệu để đề xuất người dùng sử dụng

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
25 thay vì
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
26 hoặc
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
27 khi họ muốn kiểm tra xem một số có phải là NaN hay không

Chúng ta có thể xem xét vấn đề này từ C và Python

Trong C, chúng ta có thể lấy bất kỳ NaN nào từ hàm

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
28

NaN trong C
#include 
#include 
#include 
#include 
#include 

int main[void] { 
	double f1 = nan["1"];
    uint64_t f1n; memcpy[&f1n, &f1, sizeof f1];
    printf["nan[\"1\"]   = %f [%" PRIx64 "]\n", f1, f1n];
 
    double f2 = nan["2"];
    uint64_t f2n; memcpy[&f2n, &f2, sizeof f2];
    printf["nan[\"2\"]   = %f [%" PRIx64 "]\n", f2, f2n];
 
    double f3 = -nan[""];
    uint64_t f3n; memcpy[&f3n, &f3, sizeof f3];
    printf["-nan[\"\"] = %f [%" PRIx64 "]\n", f3, f3n];
    
    double f4 = nan[""];
    uint64_t f4n; memcpy[&f4n, &f4, sizeof f4];
    printf["nan[\"\"]   = %f [%" PRIx64 "]\n", f4, f4n];
	return 0;
}

/**
 * Output:
 * nan["1"]   = nan [7ff8000000000001]
 * nan["2"]   = nan [7ff8000000000002]
 * -nan[""] = -nan [fff8000000000000]
 * nan[""]   = nan [7ff8000000000000]
 */

Nhưng trong Python thì không có sự tự do như vậy, chúng ta chỉ có thể lấy NaN thông qua hàm

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
29,
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
30 hoặc một số thao tác đặc biệt [chẳng hạn như
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
31]. Giá trị trả về của
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
29 là một đối tượng Python, chúng ta nên tập trung vào triển khai cơ bản của nó. Tôi đặt một số mã ở đây để minh họa giá trị của NaN trong Python

NaN trong Python
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif

Như chúng ta có thể thấy, giá trị thực của

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
29 có thể thu được bằng macro
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
2, một giá trị cố định. Vì vậy, việc tạo NaN thành một singleton trong CPython là có sẵn

Có thể có chỗ nào chưa hoàn thiện mong bạn sửa lại.

Có 9007199254740990 NAN có thể có trong các float IEEE-754 64 bit

Nếu số float của bạn đến từ một nguồn dữ liệu bên ngoài hoặc một hàm được viết bằng C, Fortran, Java, Rust, v.v., thì bạn có thể nhận được bất kỳ một trong số 9e15 NAN đó. Sử dụng

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
26 để kiểm tra NAN không bao giờ đúng. Ngay cả khi chúng tôi đã lưu vào bộ đệm float['nan'] để điều này luôn đúng

math.nan is float['nan']

vẫn sẽ sai khi kiểm tra NAN bằng cách sử dụng

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
26

CPython hiện tại thậm chí không có bộ đệm 0. 0, vậy lợi ích của việc lưu trữ NAN vào bộ nhớ đệm là gì, vốn có khả năng hiếm hơn nhiều? . ]

Trong mọi trường hợp, bộ nhớ đệm của int và float là một chi tiết triển khai. Bạn không bao giờ nên dựa vào ints hoặc float để được lưu vào bộ đệm. Làm điều đó có nghĩa là bạn không còn viết mã Python độc lập với nền tảng nữa mà buộc mã của bạn vào một phiên bản cụ thể của một trình thông dịch cụ thể trên một hệ điều hành cụ thể

NaN là viết tắt của Not A Number và là một trong những cách phổ biến để biểu thị giá trị còn thiếu trong dữ liệu. Nó là một giá trị dấu phẩy động đặc biệt và không thể chuyển đổi thành bất kỳ loại nào khác ngoài float.  

Giá trị NaN là một trong những vấn đề chính trong Phân tích dữ liệu. Điều rất cần thiết là phải xử lý NaN để có được kết quả mong muốn

 

Kiểm tra giá trị NaN trong Pandas DataFrame

Các cách kiểm tra NaN trong Pandas DataFrame như sau.  

  • Kiểm tra NaN với isnull[]. giá trị. phương thức bất kỳ []
  • Đếm NaN Sử dụng isnull[]. phương pháp tổng []
  • Kiểm tra NaN Sử dụng isnull[]. giá trị. phương thức bất kỳ []
  • Đếm NaN Sử dụng isnull[]. Tổng[]. phương pháp tổng []

Phương pháp 1. Sử dụng isnull[]. giá trị. phương thức bất kỳ []

Ví dụ.  

Python3




// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
36

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
37
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
38

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
37
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
40

 

 

0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
0
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
1
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
2
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
3
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
4_______45
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
7
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
9
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
51
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
53
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
54

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
55
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
56____154
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
58
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
40
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
41

 

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
42

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
43
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
1
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
45
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
1
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
47
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
3
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
49

 

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
50

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
51
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
1
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
53
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
3
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
55
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
56
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
57

 

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
58

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
59____1360

đầu ra.  

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
4

Cũng có thể lấy các vị trí chính xác có giá trị NaN. Chúng ta có thể làm như vậy bằng cách loại bỏ. giá trị. any[] từ isnull[]. giá trị. không tí nào[].  

Python3




_______153____43____1363

đầu ra.  

0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool

Phương pháp 2. Sử dụng isnull[]. phương pháp tổng []

Ví dụ.  

Python3




// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
36

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
37
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
38

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
37
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
40

 

 

0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
0
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
1
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
2
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
3
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
4_______45
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
7
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
9
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
51
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
53
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
54

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
55
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
56____154
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
58
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
40
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
41

 

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
42

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
43
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
1
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
45
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
1
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
47
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
3
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
49

 

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
379

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
400
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
1
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
53
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
3
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
404
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
405
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
57

 

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
407

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
408

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
59
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
00
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
01
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
02
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
03
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
04

đầu ra

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
5

Phương pháp 3. Sử dụng isnull[]. giá trị. phương thức bất kỳ []

Ví dụ.  

Python3




// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
36

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
37
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
38

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
37
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
40

 

0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
10
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
1
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
2
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
13
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
4
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
5
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6______47
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
9
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
51
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
53
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
54
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
56
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6

_______427____428____158____46

// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
40
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
32

_______433

0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
34
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
35
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
36
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
38
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
40
// float['nan'] will call this function to get the value of float object.
double
_Py_parse_inf_or_nan[const char *p, char **endptr]
{
    ...
    else if [case_insensitive_match[s, "nan"]] {
        s += 3;
        retval = negate ? -Py_NAN : Py_NAN;
    }
    ...
    return retval;
}

// Py_NAN: Value that evaluates to a quiet Not-a-Number [NaN].
#if !defined[Py_NAN]
#  if _Py__has_builtin[__builtin_nan]
     // Built-in implementation of the ISO C99 function nan[]: quiet NaN.
#    define Py_NAN [__builtin_nan[""]]
#else
     // Use C99 NAN constant: quiet Not-A-Number.
     // NAN is a float, Py_NAN is a double: cast to double.
#    define Py_NAN [[double]NAN]
#  endif
#endif
54
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
42
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
44
0     False
1     False
2     False
3     False
4     False
5      True
6     False
7      True
8     False
9     False
10     True
Name: Integers, dtype: bool
6

Phao có thể là NaN không?

NaN là viết tắt của Not A Number và là một trong những cách phổ biến để biểu thị giá trị còn thiếu trong dữ liệu. Đó là một giá trị dấu phẩy động đặc biệt và không thể chuyển đổi thành bất kỳ loại nào khác ngoài float . Giá trị NaN là một trong những vấn đề chính trong Phân tích dữ liệu.

Gấu trúc NaN có nổi không?

Khi làm việc với dữ liệu bị thiếu, chúng tôi thấy rằng gấu trúc chủ yếu sử dụng NaN để biểu thị dữ liệu bị thiếu. Bởi vì NaN là số float , điều này buộc một mảng số nguyên với bất kỳ giá trị nào bị thiếu trở thành dấu phẩy động.

Kiểu dữ liệu nào là NaN Python?

NaN là viết tắt của Not A Number và là một trong những cách phổ biến để biểu thị giá trị còn thiếu trong dữ liệu. Nó là một giá trị dấu phẩy động đặc biệt và không thể chuyển đổi thành bất kỳ loại nào khác ngoài float

NumPy NaN có nổi không?

NaN là một giá trị dấu phẩy động đặc biệt không thể chuyển đổi sang bất kỳ loại nào khác ngoài float . Trong hướng dẫn này, chúng ta sẽ xem xét cách NaN hoạt động trong Pandas và Numpy.

Chủ Đề