{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {},
  "_ordered_sections": [],
  "item_file": null,
  "item_line": null,
  "item_type": null,
  "aliases": [],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": null,
  "references": null,
  "qa": "reference:arrays.scalars",
  "arbitrary": [
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Python defines only one type of a particular data class (there is only one integer type, one floating-point type, etc.). This can be convenient in applications that don't need to be concerned with all the ways data can be represented in a computer.  For scientific computing, however, more control is often needed."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In NumPy, there are 24 new fundamental Python types to describe different types of scalars. These type descriptors are mostly based on the types available in the C language that CPython is written in, with several additional types compatible with Python's types."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Array scalars have the same attributes and methods as "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "ndarrays <ndarray>",
              "domain": null,
              "role": "class",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " This allows one to treat items of an array partly on the same footing as arrays, smoothing out rough edges that result when mixing scalar and array operations."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Array scalars live in a hierarchy (see the Figure below) of data types. They can be detected using the hierarchy: For example, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "isinstance(val, np.generic)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " will return "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "True",
              "domain": "py",
              "role": "data",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " if "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "val"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is an array scalar object. Alternatively, what kind of array scalar is present can be determined using other members of the data type hierarchy. Thus, for example "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "isinstance(val, np.complexfloating)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " will return "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "True",
              "domain": "py",
              "role": "data",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " if "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "val"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is a complex valued type, while "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "isinstance(val, np.flexible)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " will return true if "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "val"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is one of the flexible itemsize array types ("
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "str_",
              "domain": null,
              "role": "class",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "bytes_",
              "domain": null,
              "role": "class",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "void",
              "domain": null,
              "role": "class",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ")."
            }
          ]
        },
        {
          "__type": "Figure",
          "__tag": 4024,
          "value": {
            "__type": "RefInfo",
            "__tag": 4000,
            "module": "numpy",
            "version": "2.4.3",
            "kind": "assets",
            "path": "dtype-hierarchy.png"
          }
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Strong",
              "__tag": 4048,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Figure:"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " Hierarchy of type objects representing the array data types. Not shown are the two integer types "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "intp",
              "domain": null,
              "role": "class",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "uintp",
              "domain": null,
              "role": "class",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " which are used for indexing (the same as the default integer since NumPy 2)."
            }
          ]
        },
        {
          "__type": "Footnote",
          "__tag": 4067,
          "label": "1",
          "children": [
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "However, array scalars are immutable, so none of the array        scalar attributes are settable."
                }
              ]
            }
          ]
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "arrays.scalars.character-codes"
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Scalars"
        }
      ],
      "level": 0,
      "target": "arrays.scalars"
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The built-in scalar types are shown below. The C-like names are associated with character codes, which are shown in their descriptions. Use of the character codes, however, is discouraged."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Some of the scalar types are essentially equivalent to fundamental Python types and therefore inherit from them as well as from the generic array scalar type:"
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "====================  ===========================  =========\nArray scalar type     Related Python type          Inherits?\n====================  ===========================  =========\n:class:`int_`         :class:`int`                 no\n:class:`double`       :class:`float`               yes\n:class:`cdouble`      :class:`complex`             yes\n:class:`bytes_`       :class:`bytes`               yes\n:class:`str_`         :class:`str`                 yes\n:class:`bool_`        :class:`bool`                no\n:class:`datetime64`   :class:`datetime.datetime`   no\n:class:`timedelta64`  :class:`datetime.timedelta`  no\n====================  ===========================  =========",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "bool_",
              "domain": null,
              "role": "class",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " data type is very similar to the Python "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "bool",
              "domain": null,
              "role": "class",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " but does not inherit from it because Python's "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "bool",
              "domain": null,
              "role": "class",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " does not allow itself to be inherited from, and on the C-level the size of the actual bool data is not the same as a Python Boolean scalar."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "warning",
          "base_type": "warning",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "warning "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "The "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "int_",
                  "domain": null,
                  "role": "class",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " type does "
                },
                {
                  "__type": "Strong",
                  "__tag": 4048,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "not"
                    }
                  ]
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " inherit from the built-in "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "int",
                  "domain": null,
                  "role": "class",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", because type "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "int",
                  "domain": null,
                  "role": "class",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " is not a fixed-width integer type."
                }
              ]
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "tip",
          "base_type": "tip",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "tip The default data type in NumPy is :class:`double`."
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Built-in scalar types"
        }
      ],
      "level": 1,
      "target": "arrays.scalars.built-in"
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "note",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "note "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "The numpy integer types mirror the behavior of C integers, and can therefore be subject to "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "overflow-errors",
                  "reference": {
                    "__type": "LocalRef",
                    "__tag": 4022,
                    "kind": "docs",
                    "path": "user:basics.types"
                  },
                  "kind": "exists"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "."
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Integer types"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Signed integer types"
        }
      ],
      "level": 3,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Unsigned integer types"
        }
      ],
      "level": 3,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "note",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "note "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Inexact scalars are printed using the fewest decimal digits needed to distinguish their value from other values of the same datatype, by judicious rounding. See the "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "unique"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " parameter of "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "format_float_positional",
                  "domain": null,
                  "role": null,
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " and "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "format_float_scientific",
                  "domain": null,
                  "role": null,
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "."
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "This means that variables with equal binary values but whose datatypes are of different precisions may display differently:"
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Inexact types"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Floating-point types"
        }
      ],
      "level": 3,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Complex floating-point types"
        }
      ],
      "level": 3,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "note",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "note "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "The data actually stored in object arrays ("
                },
                {
                  "__type": "Emphasis",
                  "__tag": 4047,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "i.e."
                    }
                  ]
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", arrays having dtype "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "object_",
                  "domain": null,
                  "role": "class",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ") are references to Python objects, not the objects themselves. Hence, object arrays behave more like usual Python "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "lists <list>",
                  "domain": null,
                  "role": "class",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", in the sense that their contents need not be of the same Python type."
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "The object type is also special because an array containing "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "object_",
                  "domain": null,
                  "role": "class",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " items does not return an "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "object_",
                  "domain": null,
                  "role": "class",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " object on item access, but instead returns the actual object that the array item refers to."
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The following data types are "
            },
            {
              "__type": "Strong",
              "__tag": 4048,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "flexible"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ": they have no predefined size and the data they describe can be of different length in different arrays. (In the character codes "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "#"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is an integer denoting how many elements the data type consists of.)"
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "warning",
          "base_type": "warning",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "warning "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "See "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "Note on string types<string-dtype-note>",
                  "domain": null,
                  "role": "ref",
                  "inventory": null
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "."
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Numeric Compatibility: If you used old typecode characters in your Numeric code (which was never recommended), you will need to change some of them to the new characters. In particular, the needed changes are "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "c -> S1"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "b -> B"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "1 -> b"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "s -> h"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "w -> H"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", and "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "u -> I"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ". These changes make the type character convention more consistent with other Python modules such as the "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "struct",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "struct",
                    "version": "*",
                    "kind": "api",
                    "path": "struct"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " module."
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Other types"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Along with their (mostly) C-derived names, the integer, float, and complex data-types are also available using a bit-width convention so that an array of the right size can always be ensured. Two aliases ("
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "numpy.intp",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": "numpy",
                "version": "*",
                "kind": "api",
                "path": "numpy:int64"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "numpy.uintp",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": "numpy",
                "version": "*",
                "kind": "api",
                "path": "numpy:uint64"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ") pointing to the integer type that is sufficiently large to hold a C pointer are also provided."
            }
          ]
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Aliases for the signed integer types (one of "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "numpy.byte",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy:int8"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "numpy.short",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy:int16"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ",    "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "numpy.intc",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy:int32"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "numpy.int_",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy:int64"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "numpy.long",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy:int64"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " and "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "numpy.longlong",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy:longlong"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ")    with the specified number of bits."
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Compatible with the C99 "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "int8_t"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "int16_t"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "int32_t"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", and    "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "int64_t"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", respectively."
                }
              ]
            }
          ]
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Alias for the unsigned integer types (one of "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "numpy.ubyte",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy:uint8"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "numpy.ushort",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy:uint16"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ",    "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "numpy.uintc",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy:uint32"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "numpy.uint",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy:uint64"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "numpy.ulong",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy:uint64"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " and "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "numpy.ulonglong",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy:ulonglong"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ")    with the specified number of bits."
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Compatible with the C99 "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "uint8_t"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "uint16_t"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "uint32_t"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", and    "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "uint64_t"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", respectively."
                }
              ]
            }
          ]
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Alias for "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "numpy.longdouble",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy:longdouble"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", named after its size in bits.    The existence of these aliases depends on the platform."
                }
              ]
            }
          ]
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Alias for "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "numpy.clongdouble",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy:clongdouble"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", named after its size in bits.    The existence of these aliases depends on the platform."
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Sized aliases"
        }
      ],
      "level": 2,
      "target": "sized-aliases"
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The array scalar objects have an "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "array priority <class.__array_priority__>",
              "domain": null,
              "role": "obj",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " of "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "NPY_SCALAR_PRIORITY"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " (-1,000,000.0). They also do not (yet) have a "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "ctypes <ndarray.ctypes>",
              "domain": null,
              "role": "attr",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " attribute. Otherwise, they share the same attributes as arrays:"
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": ".. autosummary:: \n    :toctree:generated/\n    generic.flags\n    generic.shape\n    generic.strides\n    generic.ndim\n    generic.data\n    generic.size\n    generic.itemsize\n    generic.base\n    generic.dtype\n    generic.real\n    generic.imag\n    generic.flat\n    generic.T\n    generic.__array_interface__\n    generic.__array_struct__\n    generic.__array_priority__\n    generic.__array_wrap__",
          "execution_status": null
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Attributes"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "seealso",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "seealso :ref:`arrays.indexing`, :ref:`arrays.dtypes`"
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Array scalars can be indexed like 0-dimensional arrays: if "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "x"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is an array scalar,"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x[()]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " returns a copy of array scalar"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x[...]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " returns a 0-dimensional "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "ndarray",
                      "domain": null,
                      "role": "class",
                      "inventory": null
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x['field-name']"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " returns the array scalar in the field "
                    },
                    {
                      "__type": "Emphasis",
                      "__tag": 4047,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "field-name"
                        }
                      ]
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ".   ("
                    },
                    {
                      "__type": "Emphasis",
                      "__tag": 4047,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "x"
                        }
                      ]
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can have fields, for example, when it corresponds to a structured data type.)"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Indexing"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Array scalars have exactly the same methods as arrays. The default behavior of these methods is to internally convert the scalar to an equivalent 0-dimensional array and to call the corresponding array method. In addition, math operations on array scalars are defined so that the same hardware flags are set and used to interpret the results as for "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "ufunc",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "docs",
                "path": "reference:ufuncs"
              },
              "kind": "exists"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", so that the error state used for ufuncs also carries over to the math on array scalars."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The exceptions to the above rules are given below:"
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": ".. autosummary:: \n    :toctree:generated/\n    generic.__array__\n    generic.__array_wrap__\n    generic.squeeze\n    generic.byteswap\n    generic.__reduce__\n    generic.__setstate__\n    generic.setflags",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Utility method for typing:"
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": ".. autosummary:: \n    :toctree:generated/\n    number.__class_getitem__",
          "execution_status": null
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Methods"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "There are two ways to effectively define a new array scalar type (apart from composing structured types "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "dtypes",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "docs",
                "path": "reference:arrays.dtypes"
              },
              "kind": "exists"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " from the built-in scalar types): One way is to simply subclass the "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "ndarray",
              "domain": null,
              "role": "class",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and overwrite the methods of interest. This will work to a degree, but internally certain behaviors are fixed by the data type of the array.  To fully customize the data type of an array you need to define a new data-type, and register it with NumPy. Such new types can only be defined in C, using the "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "NumPy C-API",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "docs",
                "path": "reference:c-api:index"
              },
              "kind": "exists"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Defining new types"
        }
      ],
      "level": 1,
      "target": null
    }
  ],
  "local_refs": []
}