{
  "id": 443463,
  "title": "ValueError: 'event' is both an index level and a column label, which is ambiguous.",
  "url": "/competitions/child-mind-institute-detect-sleep-states/discussion/443463",
  "author_name": "",
  "post_date": "2023-09-27T10:36:06.830124Z",
  "votes": 2,
  "comment_count": 6,
  "views": 0,
  "content": "<p>Have any one encountered this problem - ValueError: 'event' is both an index level and a column label, which is ambiguous -  when validating on event-detection-ap/metric.py,  <br>\nFor the final output of my validation submission, I have used <br>\n<code>events = events.to_pandas().reset_index().rename(columns={'index':'row_id'})</code><br>\nwhich I think, reset everything, and should not have any problem with index level or column label such problem. By the way, I am just testing out the result with different hyper parameter from <a href=\"https://www.kaggle.com/code/lccburk/feature-engineering-and-random-forest-prediction\" target=\"_blank\">this public notebook </a> and encountered this problem when I generate the result using get_events function and evaluating the result in the metric.score function.</p>",
  "messages": [
    {
      "id": "2458086",
      "postDate": "09/27/2023 10:36:06",
      "content": "<p>Have any one encountered this problem - ValueError: 'event' is both an index level and a column label, which is ambiguous -  when validating on event-detection-ap/metric.py,  <br>\nFor the final output of my validation submission, I have used <br>\n<code>events = events.to_pandas().reset_index().rename(columns={'index':'row_id'})</code><br>\nwhich I think, reset everything, and should not have any problem with index level or column label such problem. By the way, I am just testing out the result with different hyper parameter from <a href=\"https://www.kaggle.com/code/lccburk/feature-engineering-and-random-forest-prediction\" target=\"_blank\">this public notebook </a> and encountered this problem when I generate the result using get_events function and evaluating the result in the metric.score function.</p>",
      "rawMarkdown": "Have any one encountered this problem - ValueError: 'event' is both an index level and a column label, which is ambiguous -  when validating on event-detection-ap/metric.py,  \nFor the final output of my validation submission, I have used \n`events = events.to_pandas().reset_index().rename(columns={'index':'row_id'})`\nwhich I think, reset everything, and should not have any problem with index level or column label such problem. By the way, I am just testing out the result with different hyper parameter from [this public notebook ](https://www.kaggle.com/code/lccburk/feature-engineering-and-random-forest-prediction) and encountered this problem when I generate the result using get_events function and evaluating the result in the metric.score function.",
      "votes": null
    },
    {
      "id": "2458145",
      "postDate": "09/27/2023 11:27:48",
      "content": "<p>Can you try this instead and see if it works for your case?</p>\n<pre><code>events = events()(drop=True)\nevents = (((events))\n</code></pre>",
      "rawMarkdown": "Can you try this instead and see if it works for your case?\n\n```\nevents = events.to_pandas().reset_index(drop=True)\nevents.index = list(range(len(events))\n```",
      "votes": null
    },
    {
      "id": "2458174",
      "postDate": "09/27/2023 11:44:48",
      "content": "<p>Thank you! The occurrence of this error is quite rare. I'm not sure if I can intentionally reproduce this value error, as it only appeared during my tuning process with Optuna. However, I'll keep your code in my function, and hopefully the error never shows up again.😄</p>",
      "rawMarkdown": "Thank you! The occurrence of this error is quite rare. I'm not sure if I can intentionally reproduce this value error, as it only appeared during my tuning process with Optuna. However, I'll keep your code in my function, and hopefully the error never shows up again.😄",
      "votes": null
    },
    {
      "id": "2458211",
      "postDate": "09/27/2023 12:29:33",
      "content": "<p>As stated in the above post, you need to drop the relevant column with drop -&gt; True <a href=\"https://www.kaggle.com/yuchen2066\" target=\"_blank\">@yuchen2066</a> </p>",
      "rawMarkdown": "As stated in the above post, you need to drop the relevant column with drop -> True @yuchen2066",
      "votes": null
    },
    {
      "id": "2458302",
      "postDate": "09/27/2023 13:46:18",
      "content": "<p>Tried the <code>drop = True</code>, but still not work. After some further checking, The error happens when I pass in empty result into metric.score, which end up producing this error.</p>",
      "rawMarkdown": "Tried the `drop = True`, but still not work. After some further checking, The error happens when I pass in empty result into metric.score, which end up producing this error.",
      "votes": null
    },
    {
      "id": "2458867",
      "postDate": "09/27/2023 21:17:07",
      "content": "<p>Maybe you can <a href=\"https://www.kaggle.com/code/michalinahulak/feature-engineering-and-rf-optuna/comments#2457529\" target=\"_blank\">try this</a> to be able to reproduce your error.</p>",
      "rawMarkdown": "Maybe you can [try this](https://www.kaggle.com/code/michalinahulak/feature-engineering-and-rf-optuna/comments#2457529) to be able to reproduce your error.",
      "votes": null
    },
    {
      "id": "2458940",
      "postDate": "09/27/2023 23:26:24",
      "content": "<p>If the submission is an empty dataframe, the official evaluation function will also report this issue. you can check if your submission is empty after filtered by event.</p>",
      "rawMarkdown": "If the submission is an empty dataframe, the official evaluation function will also report this issue. you can check if your submission is empty after filtered by event.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2458145,
      "author_name": "rimbax",
      "author_url": "",
      "post_date": "09/27/2023 11:27:48",
      "content": "<p>Can you try this instead and see if it works for your case?</p>\n<pre><code>events = events()(drop=True)\nevents = (((events))\n</code></pre>",
      "votes": null,
      "replies": [
        {
          "id": 2458174,
          "author_name": "yuchen2066",
          "author_url": "",
          "post_date": "09/27/2023 11:44:48",
          "content": "<p>Thank you! The occurrence of this error is quite rare. I'm not sure if I can intentionally reproduce this value error, as it only appeared during my tuning process with Optuna. However, I'll keep your code in my function, and hopefully the error never shows up again.😄</p>",
          "votes": null,
          "replies": [
            {
              "id": 2458211,
              "author_name": "ravi20076",
              "author_url": "",
              "post_date": "09/27/2023 12:29:33",
              "content": "<p>As stated in the above post, you need to drop the relevant column with drop -&gt; True <a href=\"https://www.kaggle.com/yuchen2066\" target=\"_blank\">@yuchen2066</a> </p>",
              "votes": null,
              "replies": [
                {
                  "id": 2458302,
                  "author_name": "yuchen2066",
                  "author_url": "",
                  "post_date": "09/27/2023 13:46:18",
                  "content": "<p>Tried the <code>drop = True</code>, but still not work. After some further checking, The error happens when I pass in empty result into metric.score, which end up producing this error.</p>",
                  "votes": null,
                  "replies": []
                }
              ]
            },
            {
              "id": 2458867,
              "author_name": "rimbax",
              "author_url": "",
              "post_date": "09/27/2023 21:17:07",
              "content": "<p>Maybe you can <a href=\"https://www.kaggle.com/code/michalinahulak/feature-engineering-and-rf-optuna/comments#2457529\" target=\"_blank\">try this</a> to be able to reproduce your error.</p>",
              "votes": null,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2458940,
      "author_name": "leimension",
      "author_url": "",
      "post_date": "09/27/2023 23:26:24",
      "content": "<p>If the submission is an empty dataframe, the official evaluation function will also report this issue. you can check if your submission is empty after filtered by event.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2458086": "Have any one encountered this problem - ValueError: 'event' is both an index level and a column label, which is ambiguous -  when validating on event-detection-ap/metric.py,  \nFor the final output of my validation submission, I have used \n`events = events.to_pandas().reset_index().rename(columns={'index':'row_id'})`\nwhich I think, reset everything, and should not have any problem with index level or column label such problem. By the way, I am just testing out the result with different hyper parameter from [this public notebook ](https://www.kaggle.com/code/lccburk/feature-engineering-and-random-forest-prediction) and encountered this problem when I generate the result using get_events function and evaluating the result in the metric.score function.",
    "2458145": "Can you try this instead and see if it works for your case?\n\n```\nevents = events.to_pandas().reset_index(drop=True)\nevents.index = list(range(len(events))\n```",
    "2458174": "Thank you! The occurrence of this error is quite rare. I'm not sure if I can intentionally reproduce this value error, as it only appeared during my tuning process with Optuna. However, I'll keep your code in my function, and hopefully the error never shows up again.😄",
    "2458211": "As stated in the above post, you need to drop the relevant column with drop -> True @yuchen2066",
    "2458302": "Tried the `drop = True`, but still not work. After some further checking, The error happens when I pass in empty result into metric.score, which end up producing this error.",
    "2458867": "Maybe you can [try this](https://www.kaggle.com/code/michalinahulak/feature-engineering-and-rf-optuna/comments#2457529) to be able to reproduce your error.",
    "2458940": "If the submission is an empty dataframe, the official evaluation function will also report this issue. you can check if your submission is empty after filtered by event."
  },
  "source": "meta"
}