{
  "id": "python/numpy-index-error-bounds",
  "signature": "IndexError: index 5 is out of bounds for axis 0 with size 5",
  "signature_zh": "IndexError：索引 5 超出轴 0 的范围（大小为 5）",
  "regex": "IndexError:\\ index\\ 5\\ is\\ out\\ of\\ bounds\\ for\\ axis\\ 0\\ with\\ size\\ 5",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Integer index equals or exceeds array length; off-by-one or wrong axis.",
  "root_cause_type": "generic",
  "root_cause_zh": "整数索引等于或超过数组长度；差一错误或轴错误。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Silently drops data rows",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Only fixes the last-index case",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "if 0 <= i < arr.shape[0]: val = arr[i]",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "arr.take([i], mode='clip') for clamped access",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}