{
  "id": 115040,
  "title": "Convert timezone to GMT.",
  "url": "/competitions/ashrae-energy-prediction/discussion/115040",
  "author_name": "",
  "post_date": "2019-10-30T23:40:53.937947100Z",
  "votes": 14,
  "comment_count": 22,
  "views": 0,
  "content": "<p>According to city prediction made by @patrick0302 in <a href=\"https://www.kaggle.com/patrick0302/locate-cities-according-weather-temperature\">https://www.kaggle.com/patrick0302/locate-cities-according-weather-temperature</a></p>\n\n<p>The following code helps to convert the Local time to GMT\n(The code is shitty but works fine)</p>\n\n<p><code>country = {0:1,1:2,2:1,3:1,4:1,5:2,6:1,7:3,8:1,9:1,10:1,11:3,12:4,13:1,14:1,15:1}\nweather_train_df['country'] = weather_train_df['site_id'].map(country)\ntimediff = {0:4,1:0,2:7,3:4,4:7,5:0,6:4,7:4,8:4,9:5,10:7,11:4,12:0,13:5,14:4,15:4}\nweather_train_df['time_diff']= weather_train_df['site_id'].map(timediff)</code></p>\n\n<p><code>target_train_df['hour'] = target_train_df['hour'] + target_train_df['time_diff']\n    target_train_df.loc[target_train_df['hour']&gt;23, 'hour'] = target_train_df[target_train_df['hour']&gt;23]['hour'] - 24</code></p>",
  "messages": [
    {
      "id": "661963",
      "postDate": "10/30/2019 23:40:53",
      "content": "<p>According to city prediction made by @patrick0302 in <a href=\"https://www.kaggle.com/patrick0302/locate-cities-according-weather-temperature\">https://www.kaggle.com/patrick0302/locate-cities-according-weather-temperature</a></p>\n\n<p>The following code helps to convert the Local time to GMT\n(The code is shitty but works fine)</p>\n\n<p><code>country = {0:1,1:2,2:1,3:1,4:1,5:2,6:1,7:3,8:1,9:1,10:1,11:3,12:4,13:1,14:1,15:1}\nweather_train_df['country'] = weather_train_df['site_id'].map(country)\ntimediff = {0:4,1:0,2:7,3:4,4:7,5:0,6:4,7:4,8:4,9:5,10:7,11:4,12:0,13:5,14:4,15:4}\nweather_train_df['time_diff']= weather_train_df['site_id'].map(timediff)</code></p>\n\n<p><code>target_train_df['hour'] = target_train_df['hour'] + target_train_df['time_diff']\n    target_train_df.loc[target_train_df['hour']&gt;23, 'hour'] = target_train_df[target_train_df['hour']&gt;23]['hour'] - 24</code></p>",
      "rawMarkdown": "According to city prediction made by @patrick0302 in https://www.kaggle.com/patrick0302/locate-cities-according-weather-temperature\n\nThe following code helps to convert the Local time to GMT\n(The code is shitty but works fine)\n\n`country = {0:1,1:2,2:1,3:1,4:1,5:2,6:1,7:3,8:1,9:1,10:1,11:3,12:4,13:1,14:1,15:1}\nweather_train_df['country'] = weather_train_df['site_id'].map(country)\ntimediff = {0:4,1:0,2:7,3:4,4:7,5:0,6:4,7:4,8:4,9:5,10:7,11:4,12:0,13:5,14:4,15:4}\nweather_train_df['time_diff']= weather_train_df['site_id'].map(timediff)`\n\n`target_train_df['hour'] = target_train_df['hour'] + target_train_df['time_diff']\n    target_train_df.loc[target_train_df['hour']&gt;23, 'hour'] = target_train_df[target_train_df['hour']&gt;23]['hour'] - 24`",
      "votes": null
    },
    {
      "id": "661966",
      "postDate": "10/30/2019 23:50:20",
      "content": "<p>Thanks for sharing.\nI guess we're gonna have to do that ourselves, rather than the admins update the data... I wish they would show up and at least acknowledge the problem.</p>",
      "rawMarkdown": "Thanks for sharing.\nI guess we're gonna have to do that ourselves, rather than the admins update the data... I wish they would show up and at least acknowledge the problem.",
      "votes": null
    },
    {
      "id": "662181",
      "postDate": "10/31/2019 07:19:37",
      "content": "<p>Really hope so, but I guess just like other competitions they won't. :/</p>",
      "rawMarkdown": "Really hope so, but I guess just like other competitions they won't. :/",
      "votes": null
    },
    {
      "id": "662936",
      "postDate": "11/01/2019 08:38:01",
      "content": "<p>Thanks for sharing.</p>",
      "rawMarkdown": "Thanks for sharing.",
      "votes": null
    },
    {
      "id": "662937",
      "postDate": "11/01/2019 08:39:03",
      "content": "<p>By combining site and hour, you can also get local time.</p>",
      "rawMarkdown": "By combining site and hour, you can also get local time.",
      "votes": null
    },
    {
      "id": "663023",
      "postDate": "11/01/2019 10:55:38",
      "content": "<p>Thanks for sharing this! I hadn't even thought about the data being spread out across multiple time-zones and innaccurate timestamps, this is super important!</p>",
      "rawMarkdown": "Thanks for sharing this! I hadn't even thought about the data being spread out across multiple time-zones and innaccurate timestamps, this is super important!",
      "votes": null
    },
    {
      "id": "663230",
      "postDate": "11/01/2019 16:34:43",
      "content": "<p><a href=\"/danofer\">@danofer</a> Welcome. Hope it helps! :)</p>",
      "rawMarkdown": "danofer Welcome. Hope it helps! :)",
      "votes": null
    },
    {
      "id": "663231",
      "postDate": "11/01/2019 16:35:50",
      "content": "<p><a href=\"/longyin2\">@longyin2</a> Surely, but that will need onehotencoding and will eventually consume more space. Don't think a good idea for kaggle notebooks. :/</p>",
      "rawMarkdown": "longyin2 Surely, but that will need onehotencoding and will eventually consume more space. Don't think a good idea for kaggle notebooks. :/",
      "votes": null
    },
    {
      "id": "663252",
      "postDate": "11/01/2019 17:16:45",
      "content": "<p>I personally prefer adjusting weather GMT timestamps to local time rather than local siteID time to GMT.</p>",
      "rawMarkdown": "I personally prefer adjusting weather GMT timestamps to local time rather than local siteID time to GMT.",
      "votes": null
    },
    {
      "id": "663378",
      "postDate": "11/01/2019 22:44:07",
      "content": "<p>quite intresting</p>",
      "rawMarkdown": "quite intresting",
      "votes": null
    },
    {
      "id": "663400",
      "postDate": "11/02/2019 00:28:04",
      "content": "<p><a href=\"/dibyasahu\">@dibyasahu</a> Welcome. Hope it helps! :)</p>",
      "rawMarkdown": "dibyasahu Welcome. Hope it helps! :)",
      "votes": null
    },
    {
      "id": "663401",
      "postDate": "11/02/2019 00:29:00",
      "content": "<p><a href=\"/sdoria\">@sdoria</a> Do share your results. :)</p>",
      "rawMarkdown": "sdoria Do share your results. :)",
      "votes": null
    },
    {
      "id": "663410",
      "postDate": "11/02/2019 01:10:02",
      "content": "<p>I don't have results, but for data exploration it makes more sense to use local time. I'll share my quick code which uses the more convenient datetime. </p>\n\n<p>import datetime\ntimediff = {0:4,1:0,2:7,3:4,4:7,5:0,6:4,7:4,8:4,9:5,10:7,11:4,12:0,13:5,14:4,15:4} \nweather_train['time_diff']= weather_train['site_id'].map(timediff)\nweather_test['time_diff']= weather_test['site_id'].map(timediff)</p>\n\n<p>weather_train['time_diff'] = weather_train['time_diff'].apply(lambda x: datetime.timedelta(hours=x))\nweather_test['time_diff'] = weather_test['time_diff'].apply(lambda x: datetime.timedelta(hours=x))</p>\n\n<p>weather_train['timestamp'] = pd.to_datetime(weather_train['timestamp'])\nweather_test['timestamp'] = pd.to_datetime(weather_test['timestamp'])</p>\n\n<p>weather_train['timestamp_local'] = weather_train['timestamp'] - weather_train['time_diff']\nweather_test['timestamp_local'] = weather_test['timestamp'] - weather_test['time_diff']</p>",
      "rawMarkdown": "I don't have results, but for data exploration it makes more sense to use local time. I'll share my quick code which uses the more convenient datetime. \n\nimport datetime\ntimediff = {0:4,1:0,2:7,3:4,4:7,5:0,6:4,7:4,8:4,9:5,10:7,11:4,12:0,13:5,14:4,15:4} \nweather_train['time_diff']= weather_train['site_id'].map(timediff)\nweather_test['time_diff']= weather_test['site_id'].map(timediff)\n\nweather_train['time_diff'] = weather_train['time_diff'].apply(lambda x: datetime.timedelta(hours=x))\nweather_test['time_diff'] = weather_test['time_diff'].apply(lambda x: datetime.timedelta(hours=x))\n\nweather_train['timestamp'] = pd.to_datetime(weather_train['timestamp'])\nweather_test['timestamp'] = pd.to_datetime(weather_test['timestamp'])\n\nweather_train['timestamp_local'] = weather_train['timestamp'] - weather_train['time_diff']\nweather_test['timestamp_local'] = weather_test['timestamp'] - weather_test['time_diff']",
      "votes": null
    },
    {
      "id": "663565",
      "postDate": "11/02/2019 10:16:14",
      "content": "<p>Nice one mate! Thanks for sharing. Found it pretty useful.</p>",
      "rawMarkdown": "Nice one mate! Thanks for sharing. Found it pretty useful.",
      "votes": null
    },
    {
      "id": "663582",
      "postDate": "11/02/2019 11:10:30",
      "content": "<p><a href=\"/shreyansh1304\">@shreyansh1304</a> Welcome bud. Hope it helps! :)</p>",
      "rawMarkdown": "shreyansh1304 Welcome bud. Hope it helps! :)",
      "votes": null
    },
    {
      "id": "663827",
      "postDate": "11/02/2019 17:58:36",
      "content": "<p>why would GMT time matter as long as we train with building_id or site_id as we all do for now as a feature?</p>",
      "rawMarkdown": "why would GMT time matter as long as we train with building_id or site_id as we all do for now as a feature?",
      "votes": null
    },
    {
      "id": "663851",
      "postDate": "11/02/2019 18:51:48",
      "content": "<p>The conclusion multiple people have reached here is that weather data is in GMT, while meter reading data is in local time.</p>",
      "rawMarkdown": "The conclusion multiple people have reached here is that weather data is in GMT, while meter reading data is in local time.",
      "votes": null
    },
    {
      "id": "664028",
      "postDate": "11/03/2019 04:23:44",
      "content": "<p>Why not do it the other way around?</p>\n\n<p>Convert time zone to local time?</p>\n\n<p>If you want to align the behaviours of, for example, Educational or Office buildings, it's better in local time. And as the weather is linked with the consumption it shall have the same local time reference.</p>\n\n<p>I mean, the objective of the competition is to guess meters time series. If the consumption pattern is displaced because of a time offset, you won't have good results.</p>",
      "rawMarkdown": "Why not do it the other way around?\n\nConvert time zone to local time?\n\nIf you want to align the behaviours of, for example, Educational or Office buildings, it's better in local time. And as the weather is linked with the consumption it shall have the same local time reference.\n\nI mean, the objective of the competition is to guess meters time series. If the consumption pattern is displaced because of a time offset, you won't have good results.",
      "votes": null
    },
    {
      "id": "664225",
      "postDate": "11/03/2019 11:25:13",
      "content": "<p><a href=\"/juanmah\">@juanmah</a> All the times are already in there local timezone. Didn't get your point.</p>",
      "rawMarkdown": "juanmah All the times are already in there local timezone. Didn't get your point.",
      "votes": null
    },
    {
      "id": "664324",
      "postDate": "11/03/2019 13:50:28",
      "content": "<p>The weather is not. It's better to convert weather to local time. And not meter readings to GMT.</p>",
      "rawMarkdown": "The weather is not. It's better to convert weather to local time. And not meter readings to GMT.",
      "votes": null
    },
    {
      "id": "664327",
      "postDate": "11/03/2019 13:58:19",
      "content": "<p>I was suggesting the same. Better have everything in local time than everything in GMT.</p>",
      "rawMarkdown": "I was suggesting the same. Better have everything in local time than everything in GMT.",
      "votes": null
    },
    {
      "id": "664408",
      "postDate": "11/03/2019 16:19:32",
      "content": "<p>Cool will try that. Thanks for sharing.</p>",
      "rawMarkdown": "Cool will try that. Thanks for sharing.",
      "votes": null
    },
    {
      "id": "667889",
      "postDate": "11/07/2019 19:50:28",
      "content": "<p>This is amazing! Thank you!</p>",
      "rawMarkdown": "This is amazing! Thank you!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 661966,
      "author_name": "sdoria",
      "author_url": "",
      "post_date": "10/30/2019 23:50:20",
      "content": "<p>Thanks for sharing.\nI guess we're gonna have to do that ourselves, rather than the admins update the data... I wish they would show up and at least acknowledge the problem.</p>",
      "votes": null,
      "replies": [
        {
          "id": 662181,
          "author_name": "themonologue",
          "author_url": "",
          "post_date": "10/31/2019 07:19:37",
          "content": "<p>Really hope so, but I guess just like other competitions they won't. :/</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 662936,
      "author_name": "longyin2",
      "author_url": "",
      "post_date": "11/01/2019 08:38:01",
      "content": "<p>Thanks for sharing.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 662937,
      "author_name": "longyin2",
      "author_url": "",
      "post_date": "11/01/2019 08:39:03",
      "content": "<p>By combining site and hour, you can also get local time.</p>",
      "votes": null,
      "replies": [
        {
          "id": 663231,
          "author_name": "themonologue",
          "author_url": "",
          "post_date": "11/01/2019 16:35:50",
          "content": "<p><a href=\"/longyin2\">@longyin2</a> Surely, but that will need onehotencoding and will eventually consume more space. Don't think a good idea for kaggle notebooks. :/</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 663023,
      "author_name": "danofer",
      "author_url": "",
      "post_date": "11/01/2019 10:55:38",
      "content": "<p>Thanks for sharing this! I hadn't even thought about the data being spread out across multiple time-zones and innaccurate timestamps, this is super important!</p>",
      "votes": null,
      "replies": [
        {
          "id": 663230,
          "author_name": "themonologue",
          "author_url": "",
          "post_date": "11/01/2019 16:34:43",
          "content": "<p><a href=\"/danofer\">@danofer</a> Welcome. Hope it helps! :)</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 663252,
      "author_name": "sdoria",
      "author_url": "",
      "post_date": "11/01/2019 17:16:45",
      "content": "<p>I personally prefer adjusting weather GMT timestamps to local time rather than local siteID time to GMT.</p>",
      "votes": null,
      "replies": [
        {
          "id": 663401,
          "author_name": "themonologue",
          "author_url": "",
          "post_date": "11/02/2019 00:29:00",
          "content": "<p><a href=\"/sdoria\">@sdoria</a> Do share your results. :)</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 663410,
          "author_name": "sdoria",
          "author_url": "",
          "post_date": "11/02/2019 01:10:02",
          "content": "<p>I don't have results, but for data exploration it makes more sense to use local time. I'll share my quick code which uses the more convenient datetime. </p>\n\n<p>import datetime\ntimediff = {0:4,1:0,2:7,3:4,4:7,5:0,6:4,7:4,8:4,9:5,10:7,11:4,12:0,13:5,14:4,15:4} \nweather_train['time_diff']= weather_train['site_id'].map(timediff)\nweather_test['time_diff']= weather_test['site_id'].map(timediff)</p>\n\n<p>weather_train['time_diff'] = weather_train['time_diff'].apply(lambda x: datetime.timedelta(hours=x))\nweather_test['time_diff'] = weather_test['time_diff'].apply(lambda x: datetime.timedelta(hours=x))</p>\n\n<p>weather_train['timestamp'] = pd.to_datetime(weather_train['timestamp'])\nweather_test['timestamp'] = pd.to_datetime(weather_test['timestamp'])</p>\n\n<p>weather_train['timestamp_local'] = weather_train['timestamp'] - weather_train['time_diff']\nweather_test['timestamp_local'] = weather_test['timestamp'] - weather_test['time_diff']</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 663378,
      "author_name": "dibyasahu",
      "author_url": "",
      "post_date": "11/01/2019 22:44:07",
      "content": "<p>quite intresting</p>",
      "votes": null,
      "replies": [
        {
          "id": 663400,
          "author_name": "themonologue",
          "author_url": "",
          "post_date": "11/02/2019 00:28:04",
          "content": "<p><a href=\"/dibyasahu\">@dibyasahu</a> Welcome. Hope it helps! :)</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 663565,
      "author_name": "shreyansh1304",
      "author_url": "",
      "post_date": "11/02/2019 10:16:14",
      "content": "<p>Nice one mate! Thanks for sharing. Found it pretty useful.</p>",
      "votes": null,
      "replies": [
        {
          "id": 663582,
          "author_name": "themonologue",
          "author_url": "",
          "post_date": "11/02/2019 11:10:30",
          "content": "<p><a href=\"/shreyansh1304\">@shreyansh1304</a> Welcome bud. Hope it helps! :)</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 663827,
      "author_name": "snovik1975",
      "author_url": "",
      "post_date": "11/02/2019 17:58:36",
      "content": "<p>why would GMT time matter as long as we train with building_id or site_id as we all do for now as a feature?</p>",
      "votes": null,
      "replies": [
        {
          "id": 663851,
          "author_name": "sdoria",
          "author_url": "",
          "post_date": "11/02/2019 18:51:48",
          "content": "<p>The conclusion multiple people have reached here is that weather data is in GMT, while meter reading data is in local time.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 664028,
      "author_name": "juanmah",
      "author_url": "",
      "post_date": "11/03/2019 04:23:44",
      "content": "<p>Why not do it the other way around?</p>\n\n<p>Convert time zone to local time?</p>\n\n<p>If you want to align the behaviours of, for example, Educational or Office buildings, it's better in local time. And as the weather is linked with the consumption it shall have the same local time reference.</p>\n\n<p>I mean, the objective of the competition is to guess meters time series. If the consumption pattern is displaced because of a time offset, you won't have good results.</p>",
      "votes": null,
      "replies": [
        {
          "id": 664225,
          "author_name": "themonologue",
          "author_url": "",
          "post_date": "11/03/2019 11:25:13",
          "content": "<p><a href=\"/juanmah\">@juanmah</a> All the times are already in there local timezone. Didn't get your point.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 664324,
          "author_name": "juanmah",
          "author_url": "",
          "post_date": "11/03/2019 13:50:28",
          "content": "<p>The weather is not. It's better to convert weather to local time. And not meter readings to GMT.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 664327,
          "author_name": "sdoria",
          "author_url": "",
          "post_date": "11/03/2019 13:58:19",
          "content": "<p>I was suggesting the same. Better have everything in local time than everything in GMT.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 664408,
          "author_name": "themonologue",
          "author_url": "",
          "post_date": "11/03/2019 16:19:32",
          "content": "<p>Cool will try that. Thanks for sharing.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 667889,
      "author_name": "carlolepelaars",
      "author_url": "",
      "post_date": "11/07/2019 19:50:28",
      "content": "<p>This is amazing! Thank you!</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "661963": "According to city prediction made by @patrick0302 in https://www.kaggle.com/patrick0302/locate-cities-according-weather-temperature\n\nThe following code helps to convert the Local time to GMT\n(The code is shitty but works fine)\n\n`country = {0:1,1:2,2:1,3:1,4:1,5:2,6:1,7:3,8:1,9:1,10:1,11:3,12:4,13:1,14:1,15:1}\nweather_train_df['country'] = weather_train_df['site_id'].map(country)\ntimediff = {0:4,1:0,2:7,3:4,4:7,5:0,6:4,7:4,8:4,9:5,10:7,11:4,12:0,13:5,14:4,15:4}\nweather_train_df['time_diff']= weather_train_df['site_id'].map(timediff)`\n\n`target_train_df['hour'] = target_train_df['hour'] + target_train_df['time_diff']\n    target_train_df.loc[target_train_df['hour']&gt;23, 'hour'] = target_train_df[target_train_df['hour']&gt;23]['hour'] - 24`",
    "661966": "Thanks for sharing.\nI guess we're gonna have to do that ourselves, rather than the admins update the data... I wish they would show up and at least acknowledge the problem.",
    "662181": "Really hope so, but I guess just like other competitions they won't. :/",
    "662936": "Thanks for sharing.",
    "662937": "By combining site and hour, you can also get local time.",
    "663023": "Thanks for sharing this! I hadn't even thought about the data being spread out across multiple time-zones and innaccurate timestamps, this is super important!",
    "663230": "danofer Welcome. Hope it helps! :)",
    "663231": "longyin2 Surely, but that will need onehotencoding and will eventually consume more space. Don't think a good idea for kaggle notebooks. :/",
    "663252": "I personally prefer adjusting weather GMT timestamps to local time rather than local siteID time to GMT.",
    "663378": "quite intresting",
    "663400": "dibyasahu Welcome. Hope it helps! :)",
    "663401": "sdoria Do share your results. :)",
    "663410": "I don't have results, but for data exploration it makes more sense to use local time. I'll share my quick code which uses the more convenient datetime. \n\nimport datetime\ntimediff = {0:4,1:0,2:7,3:4,4:7,5:0,6:4,7:4,8:4,9:5,10:7,11:4,12:0,13:5,14:4,15:4} \nweather_train['time_diff']= weather_train['site_id'].map(timediff)\nweather_test['time_diff']= weather_test['site_id'].map(timediff)\n\nweather_train['time_diff'] = weather_train['time_diff'].apply(lambda x: datetime.timedelta(hours=x))\nweather_test['time_diff'] = weather_test['time_diff'].apply(lambda x: datetime.timedelta(hours=x))\n\nweather_train['timestamp'] = pd.to_datetime(weather_train['timestamp'])\nweather_test['timestamp'] = pd.to_datetime(weather_test['timestamp'])\n\nweather_train['timestamp_local'] = weather_train['timestamp'] - weather_train['time_diff']\nweather_test['timestamp_local'] = weather_test['timestamp'] - weather_test['time_diff']",
    "663565": "Nice one mate! Thanks for sharing. Found it pretty useful.",
    "663582": "shreyansh1304 Welcome bud. Hope it helps! :)",
    "663827": "why would GMT time matter as long as we train with building_id or site_id as we all do for now as a feature?",
    "663851": "The conclusion multiple people have reached here is that weather data is in GMT, while meter reading data is in local time.",
    "664028": "Why not do it the other way around?\n\nConvert time zone to local time?\n\nIf you want to align the behaviours of, for example, Educational or Office buildings, it's better in local time. And as the weather is linked with the consumption it shall have the same local time reference.\n\nI mean, the objective of the competition is to guess meters time series. If the consumption pattern is displaced because of a time offset, you won't have good results.",
    "664225": "juanmah All the times are already in there local timezone. Didn't get your point.",
    "664324": "The weather is not. It's better to convert weather to local time. And not meter readings to GMT.",
    "664327": "I was suggesting the same. Better have everything in local time than everything in GMT.",
    "664408": "Cool will try that. Thanks for sharing.",
    "667889": "This is amazing! Thank you!"
  },
  "source": "meta"
}