{
  "id": 45993,
  "title": "createTimeSlices in R looking for similar function in python ",
  "url": "/competitions/favorita-grocery-sales-forecasting/discussion/45993",
  "author_name": "",
  "post_date": "2017-12-19T05:01:43.988621400Z",
  "votes": null,
  "comment_count": 4,
  "views": 0,
  "content": "<p>Is there a function in python similar to  what I have in R </p>\n\n<p>createTimeSlices(1:nrow(data), \n                   initialWindow = 36, horizon = 12, fixedWindow = TRUE)</p>\n\n<p>Appreciated </p>",
  "messages": [
    {
      "id": "259862",
      "postDate": "12/19/2017 05:01:43",
      "content": "<p>Is there a function in python similar to  what I have in R </p>\n\n<p>createTimeSlices(1:nrow(data), \n                   initialWindow = 36, horizon = 12, fixedWindow = TRUE)</p>\n\n<p>Appreciated </p>",
      "rawMarkdown": "Is there a function in python similar to  what I have in R \n\ncreateTimeSlices(1:nrow(data), \n                   initialWindow = 36, horizon = 12, fixedWindow = TRUE)\n\nAppreciated",
      "votes": null
    },
    {
      "id": "260060",
      "postDate": "12/19/2017 13:51:28",
      "content": "<p>Are you looking for something like this?\nDataFrame.rolling(window, min_periods=None, freq=None, center=False, win_type=None, on=None, axis=0, closed=None)</p>",
      "rawMarkdown": "Are you looking for something like this?\nDataFrame.rolling(window, min_periods=None, freq=None, center=False, win_type=None, on=None, axis=0, closed=None)",
      "votes": null
    },
    {
      "id": "260387",
      "postDate": "12/20/2017 05:31:26",
      "content": "<p>Pratik , thanks for response. With Dataframe.rolling I believe we will miss the time component for split unless you think otherwise.  The closest i found till now is <a href=\"https://machinelearningmastery.com/backtest-machine-learning-models-time-series-forecasting/\">in this link</a> . Where we can use the series itself to filter values as per date. More i will get to know once I submit my predictions. </p>",
      "rawMarkdown": "Pratik , thanks for response. With Dataframe.rolling I believe we will miss the time component for split unless you think otherwise.  The closest i found till now is [in this link][1] . Where we can use the series itself to filter values as per date. More i will get to know once I submit my predictions. \n\n  [1]: https://machinelearningmastery.com/backtest-machine-learning-models-time-series-forecasting/",
      "votes": null
    },
    {
      "id": "260581",
      "postDate": "12/20/2017 13:50:37",
      "content": "<p>Sorry, I am not much familiar with R so did not understand the syntax rightly. Are you trying to split into train and test datasets, then the link you shared is the right one.</p>",
      "rawMarkdown": "Sorry, I am not much familiar with R so did not understand the syntax rightly. Are you trying to split into train and test datasets, then the link you shared is the right one.",
      "votes": null
    },
    {
      "id": "260647",
      "postDate": "12/20/2017 16:54:18",
      "content": "<p>what about this</p>\n\n<pre><code>pandas.date_range(start=None, end=None, periods=None, freq='D', tz=None, normalize=False, name=None, closed=None, **kwargs)\n</code></pre>\n\n<p>Return a fixed frequency DatetimeIndex, with day (calendar) as the default frequency.</p>\n\n<p>eg:</p>\n\n<pre><code>from datetime import date, timedelta\npd.date_range(date(2017, 6, 21), periods=10,freq='3D')\n</code></pre>\n\n<p>DatetimeIndex(['2017-06-21', '2017-06-24', '2017-06-27', '2017-06-30',\n               '2017-07-03', '2017-07-06', '2017-07-09', '2017-07-12',\n               '2017-07-15', '2017-07-18'],\n              dtype='datetime64[ns]', freq='3D')</p>",
      "rawMarkdown": "what about this\n\n    pandas.date_range(start=None, end=None, periods=None, freq='D', tz=None, normalize=False, name=None, closed=None, **kwargs)\n\nReturn a fixed frequency DatetimeIndex, with day (calendar) as the default frequency.\n\neg:\n\n    from datetime import date, timedelta\n    pd.date_range(date(2017, 6, 21), periods=10,freq='3D')\nDatetimeIndex(['2017-06-21', '2017-06-24', '2017-06-27', '2017-06-30',\n               '2017-07-03', '2017-07-06', '2017-07-09', '2017-07-12',\n               '2017-07-15', '2017-07-18'],\n              dtype='datetime64[ns]', freq='3D')",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 260060,
      "author_name": "pratikkgandhi",
      "author_url": "",
      "post_date": "12/19/2017 13:51:28",
      "content": "<p>Are you looking for something like this?\nDataFrame.rolling(window, min_periods=None, freq=None, center=False, win_type=None, on=None, axis=0, closed=None)</p>",
      "votes": null,
      "replies": [
        {
          "id": 260387,
          "author_name": "ydhiman",
          "author_url": "",
          "post_date": "12/20/2017 05:31:26",
          "content": "<p>Pratik , thanks for response. With Dataframe.rolling I believe we will miss the time component for split unless you think otherwise.  The closest i found till now is <a href=\"https://machinelearningmastery.com/backtest-machine-learning-models-time-series-forecasting/\">in this link</a> . Where we can use the series itself to filter values as per date. More i will get to know once I submit my predictions. </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 260581,
          "author_name": "pratikkgandhi",
          "author_url": "",
          "post_date": "12/20/2017 13:50:37",
          "content": "<p>Sorry, I am not much familiar with R so did not understand the syntax rightly. Are you trying to split into train and test datasets, then the link you shared is the right one.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 260647,
      "author_name": "rafarui",
      "author_url": "",
      "post_date": "12/20/2017 16:54:18",
      "content": "<p>what about this</p>\n\n<pre><code>pandas.date_range(start=None, end=None, periods=None, freq='D', tz=None, normalize=False, name=None, closed=None, **kwargs)\n</code></pre>\n\n<p>Return a fixed frequency DatetimeIndex, with day (calendar) as the default frequency.</p>\n\n<p>eg:</p>\n\n<pre><code>from datetime import date, timedelta\npd.date_range(date(2017, 6, 21), periods=10,freq='3D')\n</code></pre>\n\n<p>DatetimeIndex(['2017-06-21', '2017-06-24', '2017-06-27', '2017-06-30',\n               '2017-07-03', '2017-07-06', '2017-07-09', '2017-07-12',\n               '2017-07-15', '2017-07-18'],\n              dtype='datetime64[ns]', freq='3D')</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "259862": "Is there a function in python similar to  what I have in R \n\ncreateTimeSlices(1:nrow(data), \n                   initialWindow = 36, horizon = 12, fixedWindow = TRUE)\n\nAppreciated",
    "260060": "Are you looking for something like this?\nDataFrame.rolling(window, min_periods=None, freq=None, center=False, win_type=None, on=None, axis=0, closed=None)",
    "260387": "Pratik , thanks for response. With Dataframe.rolling I believe we will miss the time component for split unless you think otherwise.  The closest i found till now is [in this link][1] . Where we can use the series itself to filter values as per date. More i will get to know once I submit my predictions. \n\n  [1]: https://machinelearningmastery.com/backtest-machine-learning-models-time-series-forecasting/",
    "260581": "Sorry, I am not much familiar with R so did not understand the syntax rightly. Are you trying to split into train and test datasets, then the link you shared is the right one.",
    "260647": "what about this\n\n    pandas.date_range(start=None, end=None, periods=None, freq='D', tz=None, normalize=False, name=None, closed=None, **kwargs)\n\nReturn a fixed frequency DatetimeIndex, with day (calendar) as the default frequency.\n\neg:\n\n    from datetime import date, timedelta\n    pd.date_range(date(2017, 6, 21), periods=10,freq='3D')\nDatetimeIndex(['2017-06-21', '2017-06-24', '2017-06-27', '2017-06-30',\n               '2017-07-03', '2017-07-06', '2017-07-09', '2017-07-12',\n               '2017-07-15', '2017-07-18'],\n              dtype='datetime64[ns]', freq='3D')"
  },
  "source": "meta"
}