{"action":"closed","issue":{"url":"https://api.github.com/repos/frictionlessdata/jsontableschema-pandas-py/issues/7","repository_url":"https://api.github.com/repos/frictionlessdata/jsontableschema-pandas-py","labels_url":"https://api.github.com/repos/frictionlessdata/jsontableschema-pandas-py/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/frictionlessdata/jsontableschema-pandas-py/issues/7/comments","events_url":"https://api.github.com/repos/frictionlessdata/jsontableschema-pandas-py/issues/7/events","html_url":"https://github.com/frictionlessdata/jsontableschema-pandas-py/issues/7","id":157166796,"number":7,"title":"Use DatetimeIndex when appropriate instead of Index when creating DataFrames","user":{"login":"danfowler","id":772616,"avatar_url":"https://avatars.githubusercontent.com/u/772616?v=3","gravatar_id":"","url":"https://api.github.com/users/danfowler","html_url":"https://github.com/danfowler","followers_url":"https://api.github.com/users/danfowler/followers","following_url":"https://api.github.com/users/danfowler/following{/other_user}","gists_url":"https://api.github.com/users/danfowler/gists{/gist_id}","starred_url":"https://api.github.com/users/danfowler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danfowler/subscriptions","organizations_url":"https://api.github.com/users/danfowler/orgs","repos_url":"https://api.github.com/users/danfowler/repos","events_url":"https://api.github.com/users/danfowler/events{/privacy}","received_events_url":"https://api.github.com/users/danfowler/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/frictionlessdata/jsontableschema-pandas-py/labels/backlog","name":"backlog","color":"e6e6e6"},{"url":"https://api.github.com/repos/frictionlessdata/jsontableschema-pandas-py/labels/enhancement","name":"enhancement","color":"c2e0c6"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-05-27T09:31:55Z","updated_at":"2016-08-11T20:26:24Z","closed_at":"2016-08-11T20:26:24Z","body":"Given the following data and schema (note: \"Date\" is `primaryKey` with a type of `datetime`):\r\n\r\n| Date | VIXClose |  VIXHigh | VIXLow | VIXOpen |\r\n|---|---|---|---|---|\r\n| 2004-01-05T00:00:00Z | 17.49 | 18.49 | 17.44 | 18.45 |\r\n| 2004-01-06T00:00:00Z | 16.73 | 17.67 | 16.19 | 17.66 | \r\n\r\n```\r\n\"schema\": {\r\n  \"fields\": [\r\n    {\r\n      \"name\": \"Date\",\r\n      \"type\": \"datetime\",\r\n    },\r\n    {\r\n      \"name\": \"VIXOpen\",\r\n      \"type\": \"number\",\r\n    },\r\n    {\r\n      \"name\": \"VIXHigh\",\r\n      \"type\": \"number\",\r\n    },\r\n    {\r\n      \"name\": \"VIXLow\",\r\n      \"type\": \"number\",\r\n    },\r\n    {\r\n      \"name\": \"VIXClose\",\r\n      \"type\": \"number\",\r\n    }\r\n  ],\r\n  \"primaryKey\": \"Date\"\r\n}\r\n```\r\n\r\n[create_data_frame](https://github.com/frictionlessdata/jsontableschema-pandas-py/blob/master/jsontableschema_pandas/mappers.py#L35) will create a DataFrame with an index (using that `primaryKey`) that looks like this:\r\n\r\n```\r\nIndex([1073001600000000000, 1073260800000000000, 1073347200000000000,\r\n       1073433600000000000, 1073520000000000000, 1073606400000000000,\r\n       1073865600000000000, 1073952000000000000, 1074038400000000000,\r\n       1074124800000000000,\r\n       ...\r\n       1459382400000000000, 1459468800000000000, 1459728000000000000,\r\n       1459814400000000000, 1459900800000000000, 1459987200000000000,\r\n       1460073600000000000, 1460332800000000000, 1460419200000000000,\r\n       1460505600000000000],\r\n      dtype='object', name='Date', length=3091)\r\n```\r\nWhen creating a new DataFrame from a table, if the table has a `primaryKey` with a type of `datetime`, the index should be created using `pandas.DatetimeIndex` instead of `pandas.Index`.  `pandas.DatetimeIndex` will create the expected index from this data:\r\n\r\n```\r\nDatetimeIndex(['2004-01-02', '2004-01-05', '2004-01-06', '2004-01-07',\r\n               '2004-01-08', '2004-01-09', '2004-01-12', '2004-01-13',\r\n               '2004-01-14', '2004-01-15',\r\n               ...\r\n               '2016-03-31', '2016-04-01', '2016-04-04', '2016-04-05',\r\n               '2016-04-06', '2016-04-07', '2016-04-08', '2016-04-11',\r\n               '2016-04-12', '2016-04-13'],\r\n              dtype='datetime64[ns]', name='Date', length=3091, freq=None)\r\n```"}}
{"actor":{"display_login":"sirex"}}