{
  "id": "python/matplotlib-histogram-bins-error",
  "signature": "TypeError: 'bins' must be an integer, a sequence of scalars, or a string, not <class 'list'> of strings.",
  "signature_zh": "TypeError: 'bins'必须是整数、标量序列或字符串，而不是字符串列表。",
  "regex": "TypeError:\\ 'bins'\\ must\\ be\\ an\\ integer,\\ a\\ sequence\\ of\\ scalars,\\ or\\ a\\ string,\\ not\\ <class\\ 'list'>\\ of\\ strings\\.",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "Passing a list of strings as bins to plt.hist(), which expects numeric bins or a single string method (like 'auto', 'fd').",
  "root_cause_type": "generic",
  "root_cause_zh": "向plt.hist()传递了字符串列表作为bins参数，但该参数需要数值型bins或单个字符串方法（如'auto'、'fd'）。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Using a list of integers but with mixed types",
      "why_fails": "Bins must be numeric; mixed types cause conversion errors.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Passing a single string like 'auto' but in a list",
      "why_fails": "A list of one string is still a list, not a valid bins argument.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use an integer for the number of bins",
      "success_rate": 0.95,
      "how": "plt.hist(data, bins=20)",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a sequence of bin edges as numbers",
      "success_rate": 0.9,
      "how": "plt.hist(data, bins=[0, 10, 20, 30])",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-25",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}