{
  "id": 328083,
  "title": "Nan while calculating mean",
  "url": "/competitions/amex-default-prediction/discussion/328083",
  "author_name": "",
  "post_date": "2022-05-30T19:53:57.124743200Z",
  "votes": 3,
  "comment_count": 2,
  "views": 0,
  "content": "<p>train_df['P_2'].dropna().reset_index(drop=True).mean() <br>\ntried calculating mean but weirdly it throws nan as answer can anyone help?</p>",
  "messages": [
    {
      "id": "1806116",
      "postDate": "05/30/2022 19:53:57",
      "content": "<p>train_df['P_2'].dropna().reset_index(drop=True).mean() <br>\ntried calculating mean but weirdly it throws nan as answer can anyone help?</p>",
      "rawMarkdown": "train_df['P_2'].dropna().reset_index(drop=True).mean() \ntried calculating mean but weirdly it throws nan as answer can anyone help?",
      "votes": null
    },
    {
      "id": "1806881",
      "postDate": "05/31/2022 14:27:47",
      "content": "<p>If you use data type conversion of <code>float16</code> this can happen. Try computing it with <code>float32</code> and it should be just fine.</p>",
      "rawMarkdown": "If you use data type conversion of `float16` this can happen. Try computing it with `float32` and it should be just fine.",
      "votes": null
    },
    {
      "id": "1808406",
      "postDate": "06/01/2022 19:23:57",
      "content": "<p>Thanks that helps.</p>",
      "rawMarkdown": "Thanks that helps.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1806881,
      "author_name": "itacdonev",
      "author_url": "",
      "post_date": "05/31/2022 14:27:47",
      "content": "<p>If you use data type conversion of <code>float16</code> this can happen. Try computing it with <code>float32</code> and it should be just fine.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1808406,
          "author_name": "ujjwalbaranwal",
          "author_url": "",
          "post_date": "06/01/2022 19:23:57",
          "content": "<p>Thanks that helps.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1806116": "train_df['P_2'].dropna().reset_index(drop=True).mean() \ntried calculating mean but weirdly it throws nan as answer can anyone help?",
    "1806881": "If you use data type conversion of `float16` this can happen. Try computing it with `float32` and it should be just fine.",
    "1808406": "Thanks that helps."
  },
  "source": "meta"
}