{
  "id": 307676,
  "title": "beginner have a simple question",
  "url": "/competitions/football-match-probability-prediction/discussion/307676",
  "author_name": "A.D",
  "post_date": "2022-02-15T07:22:53.060000",
  "votes": 2,
  "comment_count": 12,
  "views": 0,
  "content": "<p>How to add all home_team_history_goal_{i} ,I want to get the total number of goals scored in the last ten games，When I directly add up the columns, an error will be reported</p>",
  "messages": [
    {
      "id": 1696234,
      "postDate": "2022-02-18T17:18:10.847Z",
      "content": "<p>def average_scoring(data) :<br>\n    data['home_team_average_scoreing'] = 0 <br>\n    data['away_team_average_scoreing'] = 0 <br>\n    data['home_opponent_average_scoreing'] = 0<br>\n    data['away_opponent_average_scoreing'] = 0<br>\n    for i in range(1,11) : <br>\n        data['home_team_average_scoreing'] += data[f'home_team_history_goal_{i}']<br>\n        data['away_team_average_scoreing'] += data[f'home_team_history_goal_{i}']</p>\n<pre><code>    data['home_opponent_average_scoreing'] += data[f'home_team_history_opponent_goal_{i}']\n    data['away_opponent_average_scoreing'] += data[f'away_team_history_opponent_goal_{i}']\n\ndata['home_team_average_scoreing'] /= 10 \ndata['away_team_average_scoreing'] /= 10 \ndata['home_opponent_average_scoreing'] /= 10\ndata['away_opponent_average_scoreing'] /= 10\nreturn data\n</code></pre>\n<p>this will do it </p>",
      "rawMarkdown": "def average_scoring(data) :\n    data['home_team_average_scoreing'] = 0 \n    data['away_team_average_scoreing'] = 0 \n    data['home_opponent_average_scoreing'] = 0\n    data['away_opponent_average_scoreing'] = 0\n    for i in range(1,11) : \n        data['home_team_average_scoreing'] += data[f'home_team_history_goal_{i}']\n        data['away_team_average_scoreing'] += data[f'home_team_history_goal_{i}']\n    \n        data['home_opponent_average_scoreing'] += data[f'home_team_history_opponent_goal_{i}']\n        data['away_opponent_average_scoreing'] += data[f'away_team_history_opponent_goal_{i}']\n    \n    data['home_team_average_scoreing'] /= 10 \n    data['away_team_average_scoreing'] /= 10 \n    data['home_opponent_average_scoreing'] /= 10\n    data['away_opponent_average_scoreing'] /= 10\n    return data\n    \nthis will do it \n",
      "votes": 1,
      "replies": [
        {
          "id": 1696934,
          "postDate": "2022-02-19T08:19:09.310Z",
          "content": "<p>Thank you very much</p>",
          "rawMarkdown": "Thank you very much"
        }
      ]
    },
    {
      "id": 1691059,
      "postDate": "2022-02-15T08:00:44.600Z",
      "content": "<p>Can you give a reproducible example?</p>",
      "rawMarkdown": "Can you give a reproducible example?",
      "votes": 1,
      "replies": [
        {
          "id": 1691076,
          "postDate": "2022-02-15T08:19:02.320Z",
          "content": "<p>data['home_team_history_all_goal']=data['home_team_history_goal_1']+data['home_team_history_goal_2']</p>\n<p>TypeError: unsupported operand type(s) for +: 'float' and 'method'</p>",
          "rawMarkdown": "data['home_team_history_all_goal']=data['home_team_history_goal_1']+data['home_team_history_goal_2']\n\nTypeError: unsupported operand type(s) for +: 'float' and 'method'"
        },
        {
          "id": 1691150,
          "postDate": "2022-02-15T08:59:32.107Z",
          "content": "<p>Not sure what your data is. Just do: </p>\n<pre><code>import pandas as pd\n\ntrain = pd.read_csv('/kaggle/input/football-match-probability-prediction/train.csv')\ntrain['home_team_history_all_goal']=train['home_team_history_goal_1']+train['home_team_history_goal_2']\n</code></pre>",
          "rawMarkdown": "Not sure what your data is. Just do: \n```\nimport pandas as pd\n\ntrain = pd.read_csv('/kaggle/input/football-match-probability-prediction/train.csv')\ntrain['home_team_history_all_goal']=train['home_team_history_goal_1']+train['home_team_history_goal_2']\n\n```",
          "votes": 1
        },
        {
          "id": 1691374,
          "postDate": "2022-02-15T11:31:58.650Z",
          "content": "<p>Thank you very much, the problem has been solved and there was an error in filling the vacant value</p>",
          "rawMarkdown": "Thank you very much, the problem has been solved and there was an error in filling the vacant value"
        }
      ]
    },
    {
      "id": 1690993,
      "postDate": "2022-02-15T07:22:53.060Z",
      "content": "<p>How to add all home_team_history_goal_{i} ,I want to get the total number of goals scored in the last ten games，When I directly add up the columns, an error will be reported</p>",
      "rawMarkdown": "How to add all home_team_history_goal_{i} ,I want to get the total number of goals scored in the last ten games，When I directly add up the columns, an error will be reported",
      "votes": 2
    },
    {
      "id": 1699351,
      "postDate": "2022-02-21T05:58:29.697Z",
      "rawMarkdown": "",
      "isDeleted": true,
      "replies": [
        {
          "id": 1699464,
          "postDate": "2022-02-21T07:42:41.980Z",
          "content": "<p>This is not <a href=\"https://www.kaggle.com/c/football-match-probability-prediction/rules\" target=\"_blank\">allowed</a> for this competition. What would you like to add?</p>",
          "rawMarkdown": "This is not [allowed](https://www.kaggle.com/c/football-match-probability-prediction/rules) for this competition. What would you like to add?"
        },
        {
          "id": 1699467,
          "postDate": "2022-02-21T07:46:46.283Z",
          "rawMarkdown": "",
          "isDeleted": true
        },
        {
          "id": 1699532,
          "postDate": "2022-02-21T08:47:56.287Z",
          "content": "<p>You can click Code to the left of the Discussion and click New Notebook ，in this Notebook </p>\n<h1>loading the data</h1>\n<p>train=pd.read_csv(\"../input/football-match-probability-prediction/train.csv\",encoding='ISO-8859-1')<br>\ntest=pd.read_csv(\"../input/football-match-probability-prediction/test.csv\",encoding='ISO-8859-1')</p>",
          "rawMarkdown": "You can click Code to the left of the Discussion and click New Notebook ，in this Notebook \n\n#loading the data\ntrain=pd.read_csv(\"../input/football-match-probability-prediction/train.csv\",encoding='ISO-8859-1')\ntest=pd.read_csv(\"../input/football-match-probability-prediction/test.csv\",encoding='ISO-8859-1')"
        },
        {
          "id": 1700205,
          "postDate": "2022-02-21T18:30:01.750Z",
          "rawMarkdown": "",
          "isDeleted": true
        }
      ]
    },
    {
      "id": 1691075,
      "postDate": "2022-02-15T08:18:44.823Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 1696234,
      "author_name": "Ahmed Mohamed11",
      "author_url": "",
      "post_date": "2022-02-18T17:18:10.847000",
      "content": "<p>def average_scoring(data) :<br>\n    data['home_team_average_scoreing'] = 0 <br>\n    data['away_team_average_scoreing'] = 0 <br>\n    data['home_opponent_average_scoreing'] = 0<br>\n    data['away_opponent_average_scoreing'] = 0<br>\n    for i in range(1,11) : <br>\n        data['home_team_average_scoreing'] += data[f'home_team_history_goal_{i}']<br>\n        data['away_team_average_scoreing'] += data[f'home_team_history_goal_{i}']</p>\n<pre><code>    data['home_opponent_average_scoreing'] += data[f'home_team_history_opponent_goal_{i}']\n    data['away_opponent_average_scoreing'] += data[f'away_team_history_opponent_goal_{i}']\n\ndata['home_team_average_scoreing'] /= 10 \ndata['away_team_average_scoreing'] /= 10 \ndata['home_opponent_average_scoreing'] /= 10\ndata['away_opponent_average_scoreing'] /= 10\nreturn data\n</code></pre>\n<p>this will do it </p>",
      "votes": 1,
      "replies": [
        {
          "id": 1696934,
          "author_name": "A.D",
          "author_url": "",
          "post_date": "2022-02-19T08:19:09.310000",
          "content": "<p>Thank you very much</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1691059,
      "author_name": "octosport.io",
      "author_url": "",
      "post_date": "2022-02-15T08:00:44.600000",
      "content": "<p>Can you give a reproducible example?</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1691076,
          "author_name": "A.D",
          "author_url": "",
          "post_date": "2022-02-15T08:19:02.320000",
          "content": "<p>data['home_team_history_all_goal']=data['home_team_history_goal_1']+data['home_team_history_goal_2']</p>\n<p>TypeError: unsupported operand type(s) for +: 'float' and 'method'</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1691150,
          "author_name": "octosport.io",
          "author_url": "",
          "post_date": "2022-02-15T08:59:32.107000",
          "content": "<p>Not sure what your data is. Just do: </p>\n<pre><code>import pandas as pd\n\ntrain = pd.read_csv('/kaggle/input/football-match-probability-prediction/train.csv')\ntrain['home_team_history_all_goal']=train['home_team_history_goal_1']+train['home_team_history_goal_2']\n</code></pre>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1691374,
          "author_name": "A.D",
          "author_url": "",
          "post_date": "2022-02-15T11:31:58.650000",
          "content": "<p>Thank you very much, the problem has been solved and there was an error in filling the vacant value</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1699351,
      "author_name": "",
      "author_url": "",
      "post_date": "2022-02-21T05:58:29.697000",
      "content": "",
      "votes": 0,
      "replies": [
        {
          "id": 1699464,
          "author_name": "octosport.io",
          "author_url": "",
          "post_date": "2022-02-21T07:42:41.980000",
          "content": "<p>This is not <a href=\"https://www.kaggle.com/c/football-match-probability-prediction/rules\" target=\"_blank\">allowed</a> for this competition. What would you like to add?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1699467,
          "author_name": "",
          "author_url": "",
          "post_date": "2022-02-21T07:46:46.283000",
          "content": "",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1699532,
          "author_name": "A.D",
          "author_url": "",
          "post_date": "2022-02-21T08:47:56.287000",
          "content": "<p>You can click Code to the left of the Discussion and click New Notebook ，in this Notebook </p>\n<h1>loading the data</h1>\n<p>train=pd.read_csv(\"../input/football-match-probability-prediction/train.csv\",encoding='ISO-8859-1')<br>\ntest=pd.read_csv(\"../input/football-match-probability-prediction/test.csv\",encoding='ISO-8859-1')</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1700205,
          "author_name": "",
          "author_url": "",
          "post_date": "2022-02-21T18:30:01.750000",
          "content": "",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1691075,
      "author_name": "",
      "author_url": "",
      "post_date": "2022-02-15T08:18:44.823000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1696234": "def average_scoring(data) :\n    data['home_team_average_scoreing'] = 0 \n    data['away_team_average_scoreing'] = 0 \n    data['home_opponent_average_scoreing'] = 0\n    data['away_opponent_average_scoreing'] = 0\n    for i in range(1,11) : \n        data['home_team_average_scoreing'] += data[f'home_team_history_goal_{i}']\n        data['away_team_average_scoreing'] += data[f'home_team_history_goal_{i}']\n    \n        data['home_opponent_average_scoreing'] += data[f'home_team_history_opponent_goal_{i}']\n        data['away_opponent_average_scoreing'] += data[f'away_team_history_opponent_goal_{i}']\n    \n    data['home_team_average_scoreing'] /= 10 \n    data['away_team_average_scoreing'] /= 10 \n    data['home_opponent_average_scoreing'] /= 10\n    data['away_opponent_average_scoreing'] /= 10\n    return data\n    \nthis will do it \n",
    "1691059": "Can you give a reproducible example?",
    "1690993": "How to add all home_team_history_goal_{i} ,I want to get the total number of goals scored in the last ten games，When I directly add up the columns, an error will be reported",
    "1699351": "",
    "1691075": ""
  }
}