{"action":"created","comment":{"url":"https://api.github.com/repos/pydata/pandas/pulls/comments/61123254","id":61123254,"diff_hunk":"@@ -821,6 +821,96 @@ def my_handler_raises(obj):\n                           DataFrame({'a': [1, 2, object()]}).to_json,\n                           default_handler=my_handler_raises)\n \n+    def test_categorical(self):\n+        df = DataFrame({\"A\": [\"a\", \"b\", \"c\", \"a\", \"b\", \"b\", \"a\"]})\n+        df[\"B\"] = df[\"A\"]\n+        expected = df.to_json()\n+\n+        df[\"B\"] = df[\"A\"].astype('category')\n+        self.assertEqual(expected, df.to_json())\n+\n+        s = df[\"A\"]\n+        sc = df[\"B\"]\n+        self.assertEqual(s.to_json(), sc.to_json())\n+\n+    def test_datetime_tz(self):\n+        tz_range = pd.date_range('20130101', periods=3, tz='US/Eastern')\n+        tz_naive = tz_range.tz_convert('utc').tz_localize(None)\n+\n+        df = DataFrame({\n+            'A': tz_range,\n+            'B': pd.date_range('20130101', periods=3)})\n+\n+        df_naive = df.copy()\n+        df_naive['A'] = tz_naive\n+        expected = df_naive.to_json()\n+        self.assertEqual(expected, df.to_json())\n+\n+        stz = Series(tz_range)\n+        s_naive = Series(tz_naive)\n+        self.assertEqual(stz.to_json(), s_naive.to_json())\n+\n+    def test_sparse(self):\n+        df = pd.DataFrame(np.random.randn(10, 4))\n+        df.ix[:8] = np.nan\n+\n+        sdf = df.to_sparse()\n+        expected = df.to_json()\n+        self.assertEqual(expected, sdf.to_json())\n+\n+        s = pd.Series(np.random.randn(10))\n+        s.ix[:8] = np.nan\n+        ss = s.to_sparse()\n+\n+        expected = s.to_json()\n+        self.assertEqual(expected, ss.to_json())\n+\n+    def test_tz_is_utc(self):\n+        exp = '\"2013-01-10T05:00:00.000Z\"'\n+\n+        ts = Timestamp('2013-01-10 05:00:00Z')\n+        self.assertEqual(exp, pd.json.dumps(ts, iso_dates=True))\n+        dt = ts.to_datetime()\n+        self.assertEqual(exp, pd.json.dumps(dt, iso_dates=True))\n+\n+        ts = Timestamp('2013-01-10 00:00:00', tz='US/Eastern')\n+        self.assertEqual(exp, pd.json.dumps(ts, iso_dates=True))","path":"pandas/io/tests/test_json/test_pandas.py","position":60,"original_position":57,"commit_id":"af006a4109e83b938df09a190748b1955584bcdb","original_commit_id":"e3e6cf81417446f796c7b9952b5d5b8d97623b5c","user":{"login":"Komnomnomnom","id":107748,"avatar_url":"https://avatars.githubusercontent.com/u/107748?v=3","gravatar_id":"","url":"https://api.github.com/users/Komnomnomnom","html_url":"https://github.com/Komnomnomnom","followers_url":"https://api.github.com/users/Komnomnomnom/followers","following_url":"https://api.github.com/users/Komnomnomnom/following{/other_user}","gists_url":"https://api.github.com/users/Komnomnomnom/gists{/gist_id}","starred_url":"https://api.github.com/users/Komnomnomnom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Komnomnomnom/subscriptions","organizations_url":"https://api.github.com/users/Komnomnomnom/orgs","repos_url":"https://api.github.com/users/Komnomnomnom/repos","events_url":"https://api.github.com/users/Komnomnomnom/events{/privacy}","received_events_url":"https://api.github.com/users/Komnomnomnom/received_events","type":"User","site_admin":false},"body":"it's a kw on `pd.json.dumps`. `date_format` is the corresponding keyword on `pd.to_json`","created_at":"2016-04-26T16:58:45Z","updated_at":"2016-04-26T16:58:45Z","html_url":"https://github.com/pydata/pandas/pull/12802#discussion_r61123254","pull_request_url":"https://api.github.com/repos/pydata/pandas/pulls/12802","_links":{"self":{"href":"https://api.github.com/repos/pydata/pandas/pulls/comments/61123254"},"html":{"href":"https://github.com/pydata/pandas/pull/12802#discussion_r61123254"},"pull_request":{"href":"https://api.github.com/repos/pydata/pandas/pulls/12802"}}},"pull_request":{"url":"https://api.github.com/repos/pydata/pandas/pulls/12802","id":65342116,"html_url":"https://github.com/pydata/pandas/pull/12802","diff_url":"https://github.com/pydata/pandas/pull/12802.diff","patch_url":"https://github.com/pydata/pandas/pull/12802.patch","issue_url":"https://api.github.com/repos/pydata/pandas/issues/12802","number":12802,"state":"open","locked":false,"title":"BUG: fix json segfaults","user":{"login":"Komnomnomnom","id":107748,"avatar_url":"https://avatars.githubusercontent.com/u/107748?v=3","gravatar_id":"","url":"https://api.github.com/users/Komnomnomnom","html_url":"https://github.com/Komnomnomnom","followers_url":"https://api.github.com/users/Komnomnomnom/followers","following_url":"https://api.github.com/users/Komnomnomnom/following{/other_user}","gists_url":"https://api.github.com/users/Komnomnomnom/gists{/gist_id}","starred_url":"https://api.github.com/users/Komnomnomnom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Komnomnomnom/subscriptions","organizations_url":"https://api.github.com/users/Komnomnomnom/orgs","repos_url":"https://api.github.com/users/Komnomnomnom/repos","events_url":"https://api.github.com/users/Komnomnomnom/events{/privacy}","received_events_url":"https://api.github.com/users/Komnomnomnom/received_events","type":"User","site_admin":false},"body":"closes #11473\r\ncloses #10778\r\ncloses #11299\r\n\r\n - [ ] tests added / passed\r\n - [ ] vbench ok\r\n - [ ] windows tests pass\r\n - [x] valgrind clean\r\n - [x] passes ``git diff upstream/master | flake8 --diff``\r\n - [x] whatsnew entry\r\n\r\nThis fixes several potential segfaults in the json code:\r\n- time objects were freed and potentially garbage collected before their data had been read #11473. Was also segfaulting if an exception was raised during conversion (e.g. when using dateutil timezones).\r\n- 0d arrays were not being handled corectly (needed `goto INVALID`) #11299\r\n- all blocks were assumed to be ndarrays #10778 \r\n\r\nFixing #10778 means non-ndarray blocks are now supported (although I think at present `category` is the only one?).\r\n\r\nNot tested on windows yet. Seeing some unrelated travis failures on my fork (msgpack), is that normal?","created_at":"2016-04-05T17:21:19Z","updated_at":"2016-04-26T16:58:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"02cdba5fd2fdba73acafb9afbc1d6111a2f2a80d","assignee":null,"milestone":{"url":"https://api.github.com/repos/pydata/pandas/milestones/38","html_url":"https://github.com/pydata/pandas/milestones/0.18.1","labels_url":"https://api.github.com/repos/pydata/pandas/milestones/38/labels","id":1570594,"number":38,"title":"0.18.1","description":"after 0.18.0 of course!","creator":{"login":"jreback","id":953992,"avatar_url":"https://avatars.githubusercontent.com/u/953992?v=3","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"open_issues":43,"closed_issues":242,"state":"open","created_at":"2016-02-08T15:29:59Z","updated_at":"2016-04-26T15:46:33Z","due_on":"2016-05-10T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/pydata/pandas/pulls/12802/commits","review_comments_url":"https://api.github.com/repos/pydata/pandas/pulls/12802/comments","review_comment_url":"https://api.github.com/repos/pydata/pandas/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/12802/comments","statuses_url":"https://api.github.com/repos/pydata/pandas/statuses/af006a4109e83b938df09a190748b1955584bcdb","head":{"label":"Komnomnomnom:json-seg-faults","ref":"json-seg-faults","sha":"af006a4109e83b938df09a190748b1955584bcdb","user":{"login":"Komnomnomnom","id":107748,"avatar_url":"https://avatars.githubusercontent.com/u/107748?v=3","gravatar_id":"","url":"https://api.github.com/users/Komnomnomnom","html_url":"https://github.com/Komnomnomnom","followers_url":"https://api.github.com/users/Komnomnomnom/followers","following_url":"https://api.github.com/users/Komnomnomnom/following{/other_user}","gists_url":"https://api.github.com/users/Komnomnomnom/gists{/gist_id}","starred_url":"https://api.github.com/users/Komnomnomnom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Komnomnomnom/subscriptions","organizations_url":"https://api.github.com/users/Komnomnomnom/orgs","repos_url":"https://api.github.com/users/Komnomnomnom/repos","events_url":"https://api.github.com/users/Komnomnomnom/events{/privacy}","received_events_url":"https://api.github.com/users/Komnomnomnom/received_events","type":"User","site_admin":false},"repo":{"id":4385251,"name":"pandas","full_name":"Komnomnomnom/pandas","owner":{"login":"Komnomnomnom","id":107748,"avatar_url":"https://avatars.githubusercontent.com/u/107748?v=3","gravatar_id":"","url":"https://api.github.com/users/Komnomnomnom","html_url":"https://github.com/Komnomnomnom","followers_url":"https://api.github.com/users/Komnomnomnom/followers","following_url":"https://api.github.com/users/Komnomnomnom/following{/other_user}","gists_url":"https://api.github.com/users/Komnomnomnom/gists{/gist_id}","starred_url":"https://api.github.com/users/Komnomnomnom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Komnomnomnom/subscriptions","organizations_url":"https://api.github.com/users/Komnomnomnom/orgs","repos_url":"https://api.github.com/users/Komnomnomnom/repos","events_url":"https://api.github.com/users/Komnomnomnom/events{/privacy}","received_events_url":"https://api.github.com/users/Komnomnomnom/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Komnomnomnom/pandas","description":"Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more","fork":true,"url":"https://api.github.com/repos/Komnomnomnom/pandas","forks_url":"https://api.github.com/repos/Komnomnomnom/pandas/forks","keys_url":"https://api.github.com/repos/Komnomnomnom/pandas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Komnomnomnom/pandas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Komnomnomnom/pandas/teams","hooks_url":"https://api.github.com/repos/Komnomnomnom/pandas/hooks","issue_events_url":"https://api.github.com/repos/Komnomnomnom/pandas/issues/events{/number}","events_url":"https://api.github.com/repos/Komnomnomnom/pandas/events","assignees_url":"https://api.github.com/repos/Komnomnomnom/pandas/assignees{/user}","branches_url":"https://api.github.com/repos/Komnomnomnom/pandas/branches{/branch}","tags_url":"https://api.github.com/repos/Komnomnomnom/pandas/tags","blobs_url":"https://api.github.com/repos/Komnomnomnom/pandas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Komnomnomnom/pandas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Komnomnomnom/pandas/git/refs{/sha}","trees_url":"https://api.github.com/repos/Komnomnomnom/pandas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Komnomnomnom/pandas/statuses/{sha}","languages_url":"https://api.github.com/repos/Komnomnomnom/pandas/languages","stargazers_url":"https://api.github.com/repos/Komnomnomnom/pandas/stargazers","contributors_url":"https://api.github.com/repos/Komnomnomnom/pandas/contributors","subscribers_url":"https://api.github.com/repos/Komnomnomnom/pandas/subscribers","subscription_url":"https://api.github.com/repos/Komnomnomnom/pandas/subscription","commits_url":"https://api.github.com/repos/Komnomnomnom/pandas/commits{/sha}","git_commits_url":"https://api.github.com/repos/Komnomnomnom/pandas/git/commits{/sha}","comments_url":"https://api.github.com/repos/Komnomnomnom/pandas/comments{/number}","issue_comment_url":"https://api.github.com/repos/Komnomnomnom/pandas/issues/comments{/number}","contents_url":"https://api.github.com/repos/Komnomnomnom/pandas/contents/{+path}","compare_url":"https://api.github.com/repos/Komnomnomnom/pandas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Komnomnomnom/pandas/merges","archive_url":"https://api.github.com/repos/Komnomnomnom/pandas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Komnomnomnom/pandas/downloads","issues_url":"https://api.github.com/repos/Komnomnomnom/pandas/issues{/number}","pulls_url":"https://api.github.com/repos/Komnomnomnom/pandas/pulls{/number}","milestones_url":"https://api.github.com/repos/Komnomnomnom/pandas/milestones{/number}","notifications_url":"https://api.github.com/repos/Komnomnomnom/pandas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Komnomnomnom/pandas/labels{/name}","releases_url":"https://api.github.com/repos/Komnomnomnom/pandas/releases{/id}","deployments_url":"https://api.github.com/repos/Komnomnomnom/pandas/deployments","created_at":"2012-05-20T15:04:20Z","updated_at":"2014-01-28T12:45:34Z","pushed_at":"2016-04-26T16:54:24Z","git_url":"git://github.com/Komnomnomnom/pandas.git","ssh_url":"git@github.com:Komnomnomnom/pandas.git","clone_url":"https://github.com/Komnomnomnom/pandas.git","svn_url":"https://github.com/Komnomnomnom/pandas","homepage":"http://pandas.pydata.org","size":80493,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"pydata:master","ref":"master","sha":"f4de1570a4cbc8e8dc5b3227756bd09f9746ee12","user":{"login":"pydata","id":1284191,"avatar_url":"https://avatars.githubusercontent.com/u/1284191?v=3","gravatar_id":"","url":"https://api.github.com/users/pydata","html_url":"https://github.com/pydata","followers_url":"https://api.github.com/users/pydata/followers","following_url":"https://api.github.com/users/pydata/following{/other_user}","gists_url":"https://api.github.com/users/pydata/gists{/gist_id}","starred_url":"https://api.github.com/users/pydata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pydata/subscriptions","organizations_url":"https://api.github.com/users/pydata/orgs","repos_url":"https://api.github.com/users/pydata/repos","events_url":"https://api.github.com/users/pydata/events{/privacy}","received_events_url":"https://api.github.com/users/pydata/received_events","type":"Organization","site_admin":false},"repo":{"id":858127,"name":"pandas","full_name":"pydata/pandas","owner":{"login":"pydata","id":1284191,"avatar_url":"https://avatars.githubusercontent.com/u/1284191?v=3","gravatar_id":"","url":"https://api.github.com/users/pydata","html_url":"https://github.com/pydata","followers_url":"https://api.github.com/users/pydata/followers","following_url":"https://api.github.com/users/pydata/following{/other_user}","gists_url":"https://api.github.com/users/pydata/gists{/gist_id}","starred_url":"https://api.github.com/users/pydata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pydata/subscriptions","organizations_url":"https://api.github.com/users/pydata/orgs","repos_url":"https://api.github.com/users/pydata/repos","events_url":"https://api.github.com/users/pydata/events{/privacy}","received_events_url":"https://api.github.com/users/pydata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pydata/pandas","description":"Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more","fork":false,"url":"https://api.github.com/repos/pydata/pandas","forks_url":"https://api.github.com/repos/pydata/pandas/forks","keys_url":"https://api.github.com/repos/pydata/pandas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pydata/pandas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pydata/pandas/teams","hooks_url":"https://api.github.com/repos/pydata/pandas/hooks","issue_events_url":"https://api.github.com/repos/pydata/pandas/issues/events{/number}","events_url":"https://api.github.com/repos/pydata/pandas/events","assignees_url":"https://api.github.com/repos/pydata/pandas/assignees{/user}","branches_url":"https://api.github.com/repos/pydata/pandas/branches{/branch}","tags_url":"https://api.github.com/repos/pydata/pandas/tags","blobs_url":"https://api.github.com/repos/pydata/pandas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pydata/pandas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pydata/pandas/git/refs{/sha}","trees_url":"https://api.github.com/repos/pydata/pandas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pydata/pandas/statuses/{sha}","languages_url":"https://api.github.com/repos/pydata/pandas/languages","stargazers_url":"https://api.github.com/repos/pydata/pandas/stargazers","contributors_url":"https://api.github.com/repos/pydata/pandas/contributors","subscribers_url":"https://api.github.com/repos/pydata/pandas/subscribers","subscription_url":"https://api.github.com/repos/pydata/pandas/subscription","commits_url":"https://api.github.com/repos/pydata/pandas/commits{/sha}","git_commits_url":"https://api.github.com/repos/pydata/pandas/git/commits{/sha}","comments_url":"https://api.github.com/repos/pydata/pandas/comments{/number}","issue_comment_url":"https://api.github.com/repos/pydata/pandas/issues/comments{/number}","contents_url":"https://api.github.com/repos/pydata/pandas/contents/{+path}","compare_url":"https://api.github.com/repos/pydata/pandas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pydata/pandas/merges","archive_url":"https://api.github.com/repos/pydata/pandas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pydata/pandas/downloads","issues_url":"https://api.github.com/repos/pydata/pandas/issues{/number}","pulls_url":"https://api.github.com/repos/pydata/pandas/pulls{/number}","milestones_url":"https://api.github.com/repos/pydata/pandas/milestones{/number}","notifications_url":"https://api.github.com/repos/pydata/pandas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pydata/pandas/labels{/name}","releases_url":"https://api.github.com/repos/pydata/pandas/releases{/id}","deployments_url":"https://api.github.com/repos/pydata/pandas/deployments","created_at":"2010-08-24T01:37:33Z","updated_at":"2016-04-26T09:59:16Z","pushed_at":"2016-04-26T16:54:27Z","git_url":"git://github.com/pydata/pandas.git","ssh_url":"git@github.com:pydata/pandas.git","clone_url":"https://github.com/pydata/pandas.git","svn_url":"https://github.com/pydata/pandas","homepage":"http://pandas.pydata.org","size":151387,"stargazers_count":6138,"watchers_count":6138,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2511,"mirror_url":null,"open_issues_count":1714,"forks":2511,"open_issues":1714,"watchers":6138,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pydata/pandas/pulls/12802"},"html":{"href":"https://github.com/pydata/pandas/pull/12802"},"issue":{"href":"https://api.github.com/repos/pydata/pandas/issues/12802"},"comments":{"href":"https://api.github.com/repos/pydata/pandas/issues/12802/comments"},"review_comments":{"href":"https://api.github.com/repos/pydata/pandas/pulls/12802/comments"},"review_comment":{"href":"https://api.github.com/repos/pydata/pandas/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pydata/pandas/pulls/12802/commits"},"statuses":{"href":"https://api.github.com/repos/pydata/pandas/statuses/af006a4109e83b938df09a190748b1955584bcdb"}}}}