{
  "id": 81824,
  "title": "submit format problem",
  "url": "/competitions/humpback-whale-identification/discussion/81824",
  "author_name": "",
  "post_date": "2019-02-25T10:51:29.091471600Z",
  "votes": null,
  "comment_count": 1,
  "views": 0,
  "content": "<p>I meet some difficulty when I submit the result, my five predicting class occupy 5 cell, how to output the 5 class in one cell in python?</p>",
  "messages": [
    {
      "id": "477841",
      "postDate": "02/25/2019 10:51:29",
      "content": "<p>I meet some difficulty when I submit the result, my five predicting class occupy 5 cell, how to output the 5 class in one cell in python?</p>",
      "rawMarkdown": "I meet some difficulty when I submit the result, my five predicting class occupy 5 cell, how to output the 5 class in one cell in python?",
      "votes": null
    },
    {
      "id": "477854",
      "postDate": "02/25/2019 11:30:51",
      "content": "<p>You can use <code>pandas</code>. Load the <code>sample submission</code>, transform your array of predictions of shape (N_test, 5) into a list of strings where each string contains the 5 predictions separated by <code>space</code>.</p>\n\n<pre><code>pred_cls_str = [' '.join(pred_ids[i]) for i in range(len(pred_ids))] # get list of strings from predicted class array\ndf = pd.read_csv('/Data/sample_submission.csv').set_index('Image') # load sample submission into a dataframe\ndf.loc[idx, 'Id'] = pred_cls_str # simply replace sample submission's predictions with yours\np = datetime.datetime.now().strftime('Submission_%d_%m_%Y_%H:%M.csv') # give a path/name\ndf.to_csv(p) # save\n</code></pre>",
      "rawMarkdown": "You can use `pandas`. Load the `sample submission`, transform your array of predictions of shape (N_test, 5) into a list of strings where each string contains the 5 predictions separated by `space`.\n \n    pred_cls_str = [' '.join(pred_ids[i]) for i in range(len(pred_ids))] # get list of strings from predicted class array\n    df = pd.read_csv('/Data/sample_submission.csv').set_index('Image') # load sample submission into a dataframe\n    df.loc[idx, 'Id'] = pred_cls_str # simply replace sample submission's predictions with yours\n    p = datetime.datetime.now().strftime('Submission_%d_%m_%Y_%H:%M.csv') # give a path/name\n    df.to_csv(p) # save",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 477854,
      "author_name": "arc144",
      "author_url": "",
      "post_date": "02/25/2019 11:30:51",
      "content": "<p>You can use <code>pandas</code>. Load the <code>sample submission</code>, transform your array of predictions of shape (N_test, 5) into a list of strings where each string contains the 5 predictions separated by <code>space</code>.</p>\n\n<pre><code>pred_cls_str = [' '.join(pred_ids[i]) for i in range(len(pred_ids))] # get list of strings from predicted class array\ndf = pd.read_csv('/Data/sample_submission.csv').set_index('Image') # load sample submission into a dataframe\ndf.loc[idx, 'Id'] = pred_cls_str # simply replace sample submission's predictions with yours\np = datetime.datetime.now().strftime('Submission_%d_%m_%Y_%H:%M.csv') # give a path/name\ndf.to_csv(p) # save\n</code></pre>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "477841": "I meet some difficulty when I submit the result, my five predicting class occupy 5 cell, how to output the 5 class in one cell in python?",
    "477854": "You can use `pandas`. Load the `sample submission`, transform your array of predictions of shape (N_test, 5) into a list of strings where each string contains the 5 predictions separated by `space`.\n \n    pred_cls_str = [' '.join(pred_ids[i]) for i in range(len(pred_ids))] # get list of strings from predicted class array\n    df = pd.read_csv('/Data/sample_submission.csv').set_index('Image') # load sample submission into a dataframe\n    df.loc[idx, 'Id'] = pred_cls_str # simply replace sample submission's predictions with yours\n    p = datetime.datetime.now().strftime('Submission_%d_%m_%Y_%H:%M.csv') # give a path/name\n    df.to_csv(p) # save"
  },
  "source": "meta"
}