{
  "id": "python/numpy-broadcast-error-shapes",
  "signature": "ValueError: operands could not be broadcast together with shapes (100,3) (100,)",
  "signature_zh": "ValueError: 形状为 (100,3) 和 (100,) 的操作数无法广播",
  "regex": "ValueError:\\ operands\\ could\\ not\\ be\\ broadcast\\ together\\ with\\ shapes\\ \\(100,3\\)\\ \\(100,\\)",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "NumPy broadcasting rules require trailing dimensions to match. A (100,) array broadcasts against the last axis of (100,3), which has size 3.",
  "root_cause_type": "generic",
  "root_cause_zh": "NumPy 广播规则要求尾部维度匹配。形状 (100,) 的数组对 (100,3) 的最后一维（大小为 3）广播失败。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Produces (100,100) shape, likely wrong intent",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Produces wrong ordering unless reshaped",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "b = b[:, np.newaxis]; result = a + b  # (100,3) + (100,1)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "a + b[:, None]",
      "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-21",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}