{
  "id": 315064,
  "title": "How to pass an index while we're passing scalar values?",
  "url": "/competitions/iwildcam2022-fgvc9/discussion/315064",
  "author_name": "",
  "post_date": "2022-03-26T00:38:51.379990800Z",
  "votes": 3,
  "comment_count": 1,
  "views": 0,
  "content": "<p>Since I'm dealing we json files and dict_keys I got that error:</p>\n<p>\"ValueError: If using all scalar values, you must pass an index\" when I tried to read </p>\n<p>iwildcam2022_mdv4_detections.json</p>\n<p>Keys: 'detection_categories' and  'info',</p>\n<p>Stackoverflow have nice explanations but the the examples handle with tiny samples.</p>\n<p>Any tip is welcome. </p>\n<p>Thanks in advance.</p>",
  "messages": [
    {
      "id": "1735181",
      "postDate": "03/26/2022 00:38:51",
      "content": "<p>Since I'm dealing we json files and dict_keys I got that error:</p>\n<p>\"ValueError: If using all scalar values, you must pass an index\" when I tried to read </p>\n<p>iwildcam2022_mdv4_detections.json</p>\n<p>Keys: 'detection_categories' and  'info',</p>\n<p>Stackoverflow have nice explanations but the the examples handle with tiny samples.</p>\n<p>Any tip is welcome. </p>\n<p>Thanks in advance.</p>",
      "rawMarkdown": "Since I'm dealing we json files and dict_keys I got that error:\n\n\"ValueError: If using all scalar values, you must pass an index\" when I tried to read \n\niwildcam2022_mdv4_detections.json\n\nKeys: 'detection_categories' and  'info',\n\nStackoverflow have nice explanations but the the examples handle with tiny samples.\n\nAny tip is welcome. \n\nThanks in advance.",
      "votes": null
    },
    {
      "id": "1741986",
      "postDate": "04/01/2022 11:16:13",
      "content": "<p>What it basically means that, we need to pass an index since all the values contained in the dictionary for key 'detection_categories' are scalar.</p>\n<p>with open('../input/iwildcam2022-fgvc9/metadata/metadata/iwildcam2022_mdv4_detections.json') as f:<br>\n    data = json.load(f)<br>\nprint(data.keys())</p>\n<h1>Converting it to pandas dataframe</h1>\n<p>df = pd.DataFrame(data['detection_categories'], index=[0])<br>\ndf.head()</p>",
      "rawMarkdown": "What it basically means that, we need to pass an index since all the values contained in the dictionary for key 'detection_categories' are scalar.\n\nwith open('../input/iwildcam2022-fgvc9/metadata/metadata/iwildcam2022_mdv4_detections.json') as f:\n    data = json.load(f)\nprint(data.keys())\n#Converting it to pandas dataframe\ndf = pd.DataFrame(data['detection_categories'], index=[0])\ndf.head()",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1741986,
      "author_name": "maunilshah",
      "author_url": "",
      "post_date": "04/01/2022 11:16:13",
      "content": "<p>What it basically means that, we need to pass an index since all the values contained in the dictionary for key 'detection_categories' are scalar.</p>\n<p>with open('../input/iwildcam2022-fgvc9/metadata/metadata/iwildcam2022_mdv4_detections.json') as f:<br>\n    data = json.load(f)<br>\nprint(data.keys())</p>\n<h1>Converting it to pandas dataframe</h1>\n<p>df = pd.DataFrame(data['detection_categories'], index=[0])<br>\ndf.head()</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1735181": "Since I'm dealing we json files and dict_keys I got that error:\n\n\"ValueError: If using all scalar values, you must pass an index\" when I tried to read \n\niwildcam2022_mdv4_detections.json\n\nKeys: 'detection_categories' and  'info',\n\nStackoverflow have nice explanations but the the examples handle with tiny samples.\n\nAny tip is welcome. \n\nThanks in advance.",
    "1741986": "What it basically means that, we need to pass an index since all the values contained in the dictionary for key 'detection_categories' are scalar.\n\nwith open('../input/iwildcam2022-fgvc9/metadata/metadata/iwildcam2022_mdv4_detections.json') as f:\n    data = json.load(f)\nprint(data.keys())\n#Converting it to pandas dataframe\ndf = pd.DataFrame(data['detection_categories'], index=[0])\ndf.head()"
  },
  "source": "meta"
}