{
 "kind": "tool",
 "slug": "numpy",
 "path": "tools/numpy/",
 "name": "NumPy",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "ML and data science",
   "tools/ml-data-science/"
  ]
 ],
 "lead": "Fast math on lots of numbers in Python.",
 "chips": [
  {
   "label": "ML and data science",
   "path": "tools/ml-data-science/"
  },
  {
   "label": "PYPI"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "pip install numpy"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/numpy/numpy"
  },
  {
   "label": "Website",
   "href": "https://numpy.org"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met",
   "note": "Paid and closed-source products may use NumPy; no fee and no credit on screen is needed.",
   "src": "https://github.com/numpy/numpy/blob/main/LICENSE.txt"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 24, 2026",
   "note": "Latest GitHub release Nov 15, 2026. ",
   "src": "https://github.com/numpy/numpy"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "362 projects",
   "status": "info",
   "sub": "#1 of 293 in its category",
   "note": "Dependency in 362 public GitHub projects set up for AI coding agents that we scanned (5.8%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 10, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What NumPy does",
   "parts": [
    {
     "t": "prose",
     "text": "NumPy is a free Python library that does math on thousands or millions of numbers at once. Your app or your AI assistant's script can get averages and percentiles, draw random samples and compare AI text vectors in a few lines. Most Python data and AI libraries take and return NumPy arrays."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Rank search results by meaning",
       "text": "Your app turns each document and the user's question into an AI text vector; NumPy scores every document against the question and returns the closest ones.",
       "idea": true
      },
      {
       "title": "Summarise numbers from your logs",
       "text": "Turn a column of page load times or order totals into a median, a 95th percentile and a count of outliers for a status page or a report.",
       "idea": false
      },
      {
       "title": "Pick a fair random test group",
       "text": "Choose 500 users for a new feature or make test data, and get the same picks again next time by fixing the seed.",
       "idea": false
      },
      {
       "title": "Keep computed vectors in a file",
       "text": "Save thousands of AI text vectors to one file after computing them once, and load them back in a moment on the next start.",
       "idea": false
      },
      {
       "title": "Hand data to other libraries",
       "text": "pandas tables, scikit-learn models, image tools and chart libraries all read NumPy arrays, so one format moves through the whole data script.",
       "idea": false
      },
      {
       "title": "Edit pictures as grids of numbers",
       "text": "Load a photo with an image library, brighten it, crop it or swap colours as a grid of pixel numbers, then save it again.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "NumPy popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "86",
       "of": "/ 100",
       "l": "Gid Score, #24 overall"
      },
      {
       "n": "272M",
       "l": "downloads a week, pypi"
      },
      {
       "n": "33.5K",
       "l": "GitHub stars"
      },
      {
       "n": "362",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How NumPy is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "NumPy is a dependency in 362 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (22.3% of the 1,623 Python ones), #1 of 293 in ml and data science.",
      "Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 3,312; those are left out of every share on this page.",
      "The most used alternative in our scan is SciPy (114 projects).",
      "Projects that use it most often also use pandas (52.2%), python-dotenv (45.0%), Requests (44.8%).",
      "It is more common in projects set up for OpenClaw (10.8%) than for OpenCode (3.2%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "186 projects, 5.7%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "161 projects, 5.3%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "137 projects, 5.6%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "36 projects, 10.8%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "28 projects, 5.9%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "19 projects, 4.1%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "17 projects, 6.1%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "11 projects, 3.2%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 52.2% of its projects",
       "v": "pandas",
       "path": "tools/pandas/"
      },
      {
       "l": "In 45.0% of its projects",
       "v": "python-dotenv",
       "path": "tools/python-dotenv/"
      },
      {
       "l": "In 44.8% of its projects",
       "v": "Requests",
       "path": "tools/requests-py/"
      },
      {
       "l": "In 44.2% of its projects",
       "v": "Pydantic",
       "path": "tools/pydantic/"
      },
      {
       "l": "In 39.5% of its projects",
       "v": "Uvicorn",
       "path": "tools/uvicorn/"
      },
      {
       "l": "In 39.2% of its projects",
       "v": "FastAPI",
       "path": "tools/fastapi/"
      },
      {
       "l": "In 35.6% of its projects",
       "v": "PyYAML",
       "path": "tools/pyyaml/"
      },
      {
       "l": "In 32.3% of its projects",
       "v": "scikit-learn",
       "path": "tools/scikit-learn/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "NumPy in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "The API other array libraries target",
       "v": "The site says libraries for new hardware or special array types start from NumPy's API. It lists CuPy as a \"NumPy-compatible array library for GPU-accelerated computing\" and JAX as \"Composable transformations of NumPy programs.\""
      },
      {
       "l": "Vectorization and broadcasting as the shared vocabulary",
       "v": "You operate on whole arrays instead of writing Python loops. The site claims NumPy's way of doing this is the common standard for array code."
      },
      {
       "l": "Math routines in the box",
       "v": "Linear algebra, Fourier transforms and random number generators ship with the package. You do not need a second library for these basics."
      },
      {
       "l": "Bridges to C/C++ and Fortran",
       "v": "The README lists tools for integrating C/C++ and Fortran code as a core feature, next to the array object itself."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Recent Python only",
       "v": "The 2.5.4 release notes list support for Python 3.12 to 3.15. Projects pinned to older interpreters need an older NumPy."
      },
      {
       "l": "Patch releases can change error behavior",
       "v": "Code that passed infinities to <code>svd</code> or <code>lstsq</code> and got a result back will now see an exception. Add a finiteness check or handle the error."
      },
      {
       "l": "MaskedArray fill values reset on dtype change",
       "v": "In 2.5.4, a copied fill_value that the new dtype cannot represent falls back to the default. This can now emit a <code>ComplexWarning</code>."
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about NumPy",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "Open Collective: https://opencollective.com/numpy",
        "Tidelift: https://tidelift.com/funding/github/pypi/numpy",
        "Own page: https://numpy.org/about/#donate"
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "pandas: Dataframes",
        "python-dotenv: .env config loading",
        "requests: HTTP client",
        "pydantic: Data validation",
        "uvicorn: ASGI server",
        "fastapi: Web API framework"
       ]
      },
      {
       "title": "More in ML and data science",
       "path": "tools/ml-data-science/",
       "items": [
        {
         "text": "pandas",
         "path": "tools/pandas/"
        },
        {
         "text": "scikit-learn",
         "path": "tools/scikit-learn/"
        },
        {
         "text": "PyTorch",
         "path": "tools/torch/"
        },
        {
         "text": "Sentence Transformers",
         "path": "tools/sentence-transformers/"
        },
        {
         "text": "Hugging Face Transformers",
         "path": "tools/transformers/"
        },
        {
         "text": "Chroma (Python)",
         "path": "tools/chromadb-pypi/"
        },
        {
         "text": "NetworkX",
         "path": "tools/networkx/"
        },
        {
         "text": "PyArrow",
         "path": "tools/pyarrow/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "NumPy",
       "me": true,
       "facts": [
        "BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0",
        "Gid 86",
        "272M/wk"
       ]
      },
      {
       "name": "pandas",
       "why": "Pick pandas when your data is a table with named columns, dates and text, such as a CSV export, rather than plain numbers.",
       "path": "tools/pandas/",
       "facts": []
      },
      {
       "name": "PyTorch",
       "why": "Pick PyTorch when you train or run neural networks and need a graphics card; it has its own arrays called tensors.",
       "path": "tools/torch/",
       "facts": []
      },
      {
       "name": "SciPy",
       "why": "Pick SciPy on top of NumPy when you need ready-made scientific routines such as optimisation, signal filters or statistical tests.",
       "path": "tools/scipy/",
       "facts": [
        "BSD",
        "Gid 80",
        "102M/wk"
       ]
      }
     ],
     "more": "Compare NumPy with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Use NumPy (pin numpy==2.5.4, Python 3.12+) to load these numbers into an array, compute the median and 95th percentile, and use np.random.default_rng with a fixed seed for any random sampling."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Install NumPy into your project's Python environment (Python 3.12 to 3.14 for NumPy 2.5).",
       "code": "pip install numpy",
       "src": "https://numpy.org/install/"
      },
      {
       "text": "Check that it works by printing the installed version.",
       "code": "import numpy as np\nprint(np.__version__)\n",
       "src": "https://numpy.org/install/"
      },
      {
       "text": "Make a seeded random generator and draw numbers from it, the way the docs recommend.",
       "code": "import numpy as np\nrng = np.random.default_rng()\nsamples = rng.normal(size=2500)\n",
       "src": "https://numpy.org/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## NumPy\n- Import it the standard way: `import numpy as np`.\n- Create random numbers with a generator from `np.random.default_rng()`, as the homepage example does.\n- Prefer vectorized, indexed and broadcast array operations to Python loops over elements.\n- Check the Python version: the 2.5.4 release supports Python 3.12-3.15.\n- From 2.5.4, `numpy.linalg.svd` and `numpy.linalg.lstsq` raise for inputs containing infinities. Validate inputs or catch the error, and do not rely on a returned result.\n- To run NumPy's own tests after install, have `pytest` available and call `numpy.test()`.\n"
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "np.float_, np.NaN, np.Inf and other names from NumPy 1.x tutorials",
       "fix": "np.float64, np.nan, np.inf; run ruff check --select NPY201 to find the rest",
       "why": "NumPy 2.0 removed about 100 old names; in our run np.float_ raised AttributeError (\"was removed in the NumPy 2.0 release. Use np.float64 instead\")."
      },
      {
       "dont": "np.array(data, copy=False) to avoid a copy",
       "fix": "np.asarray(data)",
       "why": "In NumPy 2 copy=False means \"never copy\" and raises an error when a copy is needed, which it did in our run."
      },
      {
       "dont": "np.random.seed(42) then np.random.rand(...)",
       "fix": "rng = np.random.default_rng(42), then rng.random(...), rng.choice(...)",
       "why": "The old global functions still work, but the docs recommend the Generator, which is faster and gets the improvements."
      },
      {
       "dont": "json.dumps({\"score\": scores[0]}) with a NumPy number inside",
       "fix": "json.dumps({\"score\": float(scores[0])}) or scores[0].item()",
       "why": "NumPy numbers are not plain Python numbers; in our run json.dumps raised TypeError (Object of type float32 is not JSON serializable)."
      },
      {
       "dont": "np.load(uploaded_file, allow_pickle=True)",
       "fix": "np.load(path) with the default allow_pickle=False for files you did not make",
       "why": "Pickled object arrays can run code when loaded."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Can I use it in a paid, closed-source app?",
       "a": "Yes. The BSD-3-Clause license allows it; when you redistribute NumPy itself, keep its copyright notice and license text.",
       "evidence": {
        "url": "https://github.com/numpy/numpy/blob/main/LICENSE.txt",
        "quote": "Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution."
       }
      },
      {
       "q": "Which Python do I need?",
       "a": "NumPy 2.5 supports Python 3.12 to 3.14.",
       "evidence": {
        "url": "https://numpy.org/doc/stable/release/2.5.0-notes.html",
        "quote": "This release supports Python versions 3.12-3.14."
       }
      },
      {
       "q": "My old code fails with \"np.float_ was removed\". How do I fix it?",
       "a": "Replace the old names using the NumPy 2.0 migration guide (np.float_ becomes np.float64, np.NaN becomes np.nan); the Ruff rule NPY201 can fix many of them for you.",
       "evidence": {
        "url": "https://numpy.org/doc/stable/numpy_2_0_migration_guide.html",
        "quote": "can be automatically adapted in downstream code with a dedicated Ruff rule, namely rule"
       }
      },
      {
       "q": "Is NumPy still maintained?",
       "a": "Yes. NumPy 2.5.0 came out on 2026-06-21 and the 2.5.4 package was published on PyPI on 2026-10-10.",
       "evidence": [
        {
         "url": "https://numpy.org/",
         "quote": "NumPy 2.5.0 released 2026-06-21"
        },
        {
         "url": "https://pypi.org/pypi/numpy/2.5.4/json",
         "quote": "\"upload_time\":\"2026-10-10T20:02:40\""
        }
       ]
      },
      {
       "q": "Can I try it before installing anything?",
       "a": "Yes. The NumPy home page has an interactive shell that runs in the browser.",
       "evidence": {
        "url": "https://numpy.org/",
        "quote": "Use the interactive shell to try NumPy in the browser"
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "pypi numpy"
  ],
  [
   "Category",
   "ML and data science"
  ],
  [
   "License",
   "BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0"
  ],
  [
   "Latest version",
   "v2.5.4, October 10, 2026"
  ],
  [
   "On GitHub since",
   "September 2010"
  ],
  [
   "Gid Score",
   "86.5"
  ],
  [
   "Rank in category",
   "#1 of 293"
  ],
  [
   "GitHub",
   "numpy/numpy"
  ],
  [
   "Last change",
   "Nov 24, 2026"
  ]
 ],
 "good": [
  "NumPy 2.5 needs Python 3.12, 3.13 or 3.14; older Pythons only get older NumPy versions.",
  "Every value in one array has the same type, and an array has a fixed size; growing it makes a new copy.",
  "NumPy 2 removed or moved about 100 old names, so code from older tutorials can fail until it is updated."
 ],
 "checked_line": "Read by AgentGid from 12 official pages, card checked Nov 10, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/numpy.png"
}