{
  "id": 133163,
  "title": "Newbie Question",
  "url": "/competitions/google-cloud-ncaa-march-madness-2020-division-1-mens-tournament/discussion/133163",
  "author_name": "",
  "post_date": "2020-03-01T02:47:35.286637100Z",
  "votes": 8,
  "comment_count": 3,
  "views": 0,
  "content": "<p>I'm new to Python and Data Science and I'm trying to learn by doing.  I'm created a validation set using data from the year 2016 (arbitrary).  I'm trying to remove the 2016 data from the training set before I continue with calculations of the Four Factors.  I'm using the code below, but when I check the training data set, the 2016 year data still remains.  Any advice or a better way to do this?</p>\n\n<p>thanks,\ndave</p>\n\n<p>```\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport csv #file manipulation\nimport os</p>\n\n<p>for dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))</p>\n\n<p>tourn_results = pd.read_csv('/kaggle/input/google-cloud-ncaa-march-madness-2020-division-1-mens-tournament/MDataFiles_Stage1/MNCAATourneyDetailedResults.csv')</p>\n\n<p><strong>Create Validation set - 2016 Season</strong></p>\n\n<p>validation_set = pd.DataFrame()</p>\n\n<p>validation_set = validation_set.append(tourn_results.loc[tourn_results['Season'] == 2016])</p>\n\n<p><strong>Create Training Set 2003 - 2020 (minus 2016)</strong></p>\n\n<p>tourn_results.drop(tourn_results[tourn_results['Season'] == '2016'].index, inplace = True)</p>\n\n<p>training_set = pd.DataFrame()\n```</p>",
  "messages": [
    {
      "id": "760241",
      "postDate": "03/01/2020 02:47:35",
      "content": "<p>I'm new to Python and Data Science and I'm trying to learn by doing.  I'm created a validation set using data from the year 2016 (arbitrary).  I'm trying to remove the 2016 data from the training set before I continue with calculations of the Four Factors.  I'm using the code below, but when I check the training data set, the 2016 year data still remains.  Any advice or a better way to do this?</p>\n\n<p>thanks,\ndave</p>\n\n<p>```\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport csv #file manipulation\nimport os</p>\n\n<p>for dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))</p>\n\n<p>tourn_results = pd.read_csv('/kaggle/input/google-cloud-ncaa-march-madness-2020-division-1-mens-tournament/MDataFiles_Stage1/MNCAATourneyDetailedResults.csv')</p>\n\n<p><strong>Create Validation set - 2016 Season</strong></p>\n\n<p>validation_set = pd.DataFrame()</p>\n\n<p>validation_set = validation_set.append(tourn_results.loc[tourn_results['Season'] == 2016])</p>\n\n<p><strong>Create Training Set 2003 - 2020 (minus 2016)</strong></p>\n\n<p>tourn_results.drop(tourn_results[tourn_results['Season'] == '2016'].index, inplace = True)</p>\n\n<p>training_set = pd.DataFrame()\n```</p>",
      "rawMarkdown": "I'm new to Python and Data Science and I'm trying to learn by doing.  I'm created a validation set using data from the year 2016 (arbitrary).  I'm trying to remove the 2016 data from the training set before I continue with calculations of the Four Factors.  I'm using the code below, but when I check the training data set, the 2016 year data still remains.  Any advice or a better way to do this?\n\nthanks,\ndave\n\n\n```\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport csv #file manipulation\nimport os\n\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n        \ntourn_results = pd.read_csv('/kaggle/input/google-cloud-ncaa-march-madness-2020-division-1-mens-tournament/MDataFiles_Stage1/MNCAATourneyDetailedResults.csv')\n\n**Create Validation set - 2016 Season**\n\nvalidation_set = pd.DataFrame()\n\nvalidation_set = validation_set.append(tourn_results.loc[tourn_results['Season'] == 2016])\n\n\n**Create Training Set 2003 - 2020 (minus 2016)**\n\ntourn_results.drop(tourn_results[tourn_results['Season'] == '2016'].index, inplace = True)\n\ntraining_set = pd.DataFrame()\n```",
      "votes": null
    },
    {
      "id": "760245",
      "postDate": "03/01/2020 03:01:15",
      "content": "<p>Try\n<code>tourn_results = tourn_results[(tourn_results.Season != 2016)]</code></p>",
      "rawMarkdown": "Try\n`tourn_results = tourn_results[(tourn_results.Season != 2016)]`",
      "votes": null
    },
    {
      "id": "760526",
      "postDate": "03/01/2020 12:17:06",
      "content": "<p>You can do it using:\n tourn_results = tourn_results[torun_results['Season']!='2016'], or\n tourn_results = tourn_results[~torun_results['Season']=='2016']</p>",
      "rawMarkdown": "You can do it using:\n tourn_results = tourn_results[torun_results['Season']!='2016'], or\n tourn_results = tourn_results[~torun_results['Season']=='2016']",
      "votes": null
    },
    {
      "id": "760549",
      "postDate": "03/01/2020 12:59:38",
      "content": "<p>It works now -- thanks for the help!</p>",
      "rawMarkdown": "It works now -- thanks for the help!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 760245,
      "author_name": "btesch",
      "author_url": "",
      "post_date": "03/01/2020 03:01:15",
      "content": "<p>Try\n<code>tourn_results = tourn_results[(tourn_results.Season != 2016)]</code></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 760526,
      "author_name": "joslucasfalchetti",
      "author_url": "",
      "post_date": "03/01/2020 12:17:06",
      "content": "<p>You can do it using:\n tourn_results = tourn_results[torun_results['Season']!='2016'], or\n tourn_results = tourn_results[~torun_results['Season']=='2016']</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 760549,
      "author_name": "stroudd",
      "author_url": "",
      "post_date": "03/01/2020 12:59:38",
      "content": "<p>It works now -- thanks for the help!</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "760241": "I'm new to Python and Data Science and I'm trying to learn by doing.  I'm created a validation set using data from the year 2016 (arbitrary).  I'm trying to remove the 2016 data from the training set before I continue with calculations of the Four Factors.  I'm using the code below, but when I check the training data set, the 2016 year data still remains.  Any advice or a better way to do this?\n\nthanks,\ndave\n\n\n```\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport csv #file manipulation\nimport os\n\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n        \ntourn_results = pd.read_csv('/kaggle/input/google-cloud-ncaa-march-madness-2020-division-1-mens-tournament/MDataFiles_Stage1/MNCAATourneyDetailedResults.csv')\n\n**Create Validation set - 2016 Season**\n\nvalidation_set = pd.DataFrame()\n\nvalidation_set = validation_set.append(tourn_results.loc[tourn_results['Season'] == 2016])\n\n\n**Create Training Set 2003 - 2020 (minus 2016)**\n\ntourn_results.drop(tourn_results[tourn_results['Season'] == '2016'].index, inplace = True)\n\ntraining_set = pd.DataFrame()\n```",
    "760245": "Try\n`tourn_results = tourn_results[(tourn_results.Season != 2016)]`",
    "760526": "You can do it using:\n tourn_results = tourn_results[torun_results['Season']!='2016'], or\n tourn_results = tourn_results[~torun_results['Season']=='2016']",
    "760549": "It works now -- thanks for the help!"
  },
  "source": "meta"
}