{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Note that for higher dimensional inserts "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "obj=0"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " behaves very different from "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "obj=[0]"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " just like "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "arr[:,0,:] = values"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is different from "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "arr[:,[0],:] = values"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". This is because of the difference between basic and advanced "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "indexing <basics.indexing>",
              "domain": null,
              "role": "ref",
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "out",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A copy of "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "arr"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " with "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "values"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " inserted.  Note that "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "insert",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "numpy:insert"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " does not occur in-place: a new array is returned. If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "axis"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is None, "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "out",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": null,
                        "version": null,
                        "kind": "local",
                        "path": "out"
                      },
                      "kind": "local"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is a flattened array."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Insert values along the given axis before the given indices."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "arr",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Input array."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "obj",
              "annotation": "slice, int, array-like of ints or bools",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Object that defines the index or indices before which "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "values"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is inserted."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionchanged",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionchanged 2.1.2"
                        }
                      ]
                    },
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "Boolean indices are now treated as a mask of elements to insert, rather than being cast to the integers 0 and 1."
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Support for multiple insertions when "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "obj"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is a single scalar or a sequence with one element (similar to calling insert multiple times)."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "values",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Values to insert into "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "arr"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". If the type of "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "values"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is different from that of "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "arr"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "values"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is converted to the type of "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "arr"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "values"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " should be shaped so that "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "arr[...,obj,...] = values"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is legal."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "axis",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Axis along which to insert "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "values"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ".  If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "axis"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is None then "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "arr"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is flattened first."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/lib/_function_base_impl.py",
  "item_line": 5379,
  "item_type": "_ArrayFunctionDispatcher",
  "aliases": [
    "numpy.insert"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\na = np.arange(6).reshape(3, 2)\na\nnp.insert(a, 1, 6)\nnp.insert(a, 1, 6, axis=1)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nDifference between sequence and scalars,\nshowing how ``obj=[1]`` behaves different from ``obj=1``:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "np.insert(a, [1], [[7],[8],[9]], axis=1)\nnp.insert(a, 1, [[7],[8],[9]], axis=1)\nnp.array_equal(np.insert(a, 1, [7, 8, 9], axis=1),\n               np.insert(a, [1], [[7],[8],[9]], axis=1))\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "b = a.flatten()\nb\nnp.insert(b, [2, 2], [6, 7])\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "np.insert(b, slice(2, 4), [7, 8])\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "np.insert(b, [2, 2], [7.13, False]) # type casting\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "x = np.arange(8).reshape(2, 4)\nidx = (1, 3)\nnp.insert(x, idx, 999, axis=1)\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "append",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "append"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Append elements at the end of an array."
            }
          ]
        }
      ],
      "type": null
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "concatenate",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "concatenate"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Join a sequence of arrays along an existing axis."
            }
          ]
        }
      ],
      "type": null
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "delete",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "delete"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Delete elements from an array."
            }
          ]
        }
      ],
      "type": null
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "arr",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "obj",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "values",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "axis",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "insert"
  },
  "references": null,
  "qa": "numpy:insert",
  "arbitrary": [],
  "local_refs": [
    "arr",
    "axis",
    "obj",
    "out",
    "values"
  ]
}