{"action":"created","comment":{"url":"https://api.github.com/repos/dask/dask/pulls/comments/67622897","id":67622897,"diff_hunk":"@@ -637,26 +637,54 @@ def to_castra(df, fn=None, categories=None, sorted_index_column=None,\n         return delayed([Delayed(key, [dsk]) for key in keys])\n \n \n-def to_csv(df, filename, compression=None, get=None, compute=True, **kwargs):\n+def to_csv(df, filename, name_function=None, compression=None, get=None, compute=True, **kwargs):\n     if compression:\n         raise NotImplementedError(\"Writing compressed csv files not supported\")\n     name = 'to-csv-' + uuid.uuid1().hex\n \n+    kwargs2 = kwargs.copy()\n+\n+    if name_function is None:\n+        name_function = build_name_function(df.npartitions - 1)\n+\n+    if '*' in filename:\n+        formatted_names = [name_function(i) for i in range(df.npartitions)]\n+        if formatted_names != sorted(formatted_names):\n+            warn(\"In order to preserve order between partitions \"\n+                 \"name_function must preserve the order of its input\")\n+\n+        if filename.count('*') > 1:\n+            raise ValueError(\"A maximum of one asterisk is accepted in filename\")\n+\n+        if 'mode' in kwargs and kwargs['mode'] != 'w':\n+            raise ValueError(\"to_csv does not support writing to multiple files in append mode, \"\n+                             \"please specify mode='w'\")\n+\n+        link = False\n+    else:\n+        kwargs2['mode'] = 'a'\n+        kwargs2['header'] = False\n+        link = True","path":"dask/dataframe/io.py","position":32,"original_position":32,"commit_id":"2fce1e7ba3be3b0d3483ed1161361c23ad0c0a4d","original_commit_id":"2fce1e7ba3be3b0d3483ed1161361c23ad0c0a4d","user":{"login":"nirizr","id":3631703,"avatar_url":"https://avatars.githubusercontent.com/u/3631703?v=3","gravatar_id":"","url":"https://api.github.com/users/nirizr","html_url":"https://github.com/nirizr","followers_url":"https://api.github.com/users/nirizr/followers","following_url":"https://api.github.com/users/nirizr/following{/other_user}","gists_url":"https://api.github.com/users/nirizr/gists{/gist_id}","starred_url":"https://api.github.com/users/nirizr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nirizr/subscriptions","organizations_url":"https://api.github.com/users/nirizr/orgs","repos_url":"https://api.github.com/users/nirizr/repos","events_url":"https://api.github.com/users/nirizr/events{/privacy}","received_events_url":"https://api.github.com/users/nirizr/received_events","type":"User","site_admin":false},"body":"this flag is essentially controlling wether we're linknig tasks or not.\r\nIn this PR its identical to whether there're multiple files, but in to_hdf it's a bit more complicated.\r\nI wanted to keep the meaning.","created_at":"2016-06-19T19:59:10Z","updated_at":"2016-06-19T19:59:10Z","html_url":"https://github.com/dask/dask/pull/1303#discussion_r67622897","pull_request_url":"https://api.github.com/repos/dask/dask/pulls/1303","_links":{"self":{"href":"https://api.github.com/repos/dask/dask/pulls/comments/67622897"},"html":{"href":"https://github.com/dask/dask/pull/1303#discussion_r67622897"},"pull_request":{"href":"https://api.github.com/repos/dask/dask/pulls/1303"}}},"pull_request":{"url":"https://api.github.com/repos/dask/dask/pulls/1303","id":74349179,"html_url":"https://github.com/dask/dask/pull/1303","diff_url":"https://github.com/dask/dask/pull/1303.diff","patch_url":"https://github.com/dask/dask/pull/1303.patch","issue_url":"https://api.github.com/repos/dask/dask/issues/1303","number":1303,"state":"open","locked":false,"title":"make dd.to_csv accept name_function and asterisk in filename for multiple file write support","user":{"login":"nirizr","id":3631703,"avatar_url":"https://avatars.githubusercontent.com/u/3631703?v=3","gravatar_id":"","url":"https://api.github.com/users/nirizr","html_url":"https://github.com/nirizr","followers_url":"https://api.github.com/users/nirizr/followers","following_url":"https://api.github.com/users/nirizr/following{/other_user}","gists_url":"https://api.github.com/users/nirizr/gists{/gist_id}","starred_url":"https://api.github.com/users/nirizr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nirizr/subscriptions","organizations_url":"https://api.github.com/users/nirizr/orgs","repos_url":"https://api.github.com/users/nirizr/repos","events_url":"https://api.github.com/users/nirizr/events{/privacy}","received_events_url":"https://api.github.com/users/nirizr/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Nir Izraeli <nirizr@gmail.com>","created_at":"2016-06-18T22:40:19Z","updated_at":"2016-06-19T19:59:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fd7821fd3f8146c13aa59ac3d2b241c538008b46","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dask/dask/pulls/1303/commits","review_comments_url":"https://api.github.com/repos/dask/dask/pulls/1303/comments","review_comment_url":"https://api.github.com/repos/dask/dask/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dask/dask/issues/1303/comments","statuses_url":"https://api.github.com/repos/dask/dask/statuses/2fce1e7ba3be3b0d3483ed1161361c23ad0c0a4d","head":{"label":"nirizr:dataframe_to_csv_multiple_files","ref":"dataframe_to_csv_multiple_files","sha":"2fce1e7ba3be3b0d3483ed1161361c23ad0c0a4d","user":{"login":"nirizr","id":3631703,"avatar_url":"https://avatars.githubusercontent.com/u/3631703?v=3","gravatar_id":"","url":"https://api.github.com/users/nirizr","html_url":"https://github.com/nirizr","followers_url":"https://api.github.com/users/nirizr/followers","following_url":"https://api.github.com/users/nirizr/following{/other_user}","gists_url":"https://api.github.com/users/nirizr/gists{/gist_id}","starred_url":"https://api.github.com/users/nirizr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nirizr/subscriptions","organizations_url":"https://api.github.com/users/nirizr/orgs","repos_url":"https://api.github.com/users/nirizr/repos","events_url":"https://api.github.com/users/nirizr/events{/privacy}","received_events_url":"https://api.github.com/users/nirizr/received_events","type":"User","site_admin":false},"repo":{"id":60001343,"name":"dask","full_name":"nirizr/dask","owner":{"login":"nirizr","id":3631703,"avatar_url":"https://avatars.githubusercontent.com/u/3631703?v=3","gravatar_id":"","url":"https://api.github.com/users/nirizr","html_url":"https://github.com/nirizr","followers_url":"https://api.github.com/users/nirizr/followers","following_url":"https://api.github.com/users/nirizr/following{/other_user}","gists_url":"https://api.github.com/users/nirizr/gists{/gist_id}","starred_url":"https://api.github.com/users/nirizr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nirizr/subscriptions","organizations_url":"https://api.github.com/users/nirizr/orgs","repos_url":"https://api.github.com/users/nirizr/repos","events_url":"https://api.github.com/users/nirizr/events{/privacy}","received_events_url":"https://api.github.com/users/nirizr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nirizr/dask","description":"Versatile parallel programming with task scheduling","fork":true,"url":"https://api.github.com/repos/nirizr/dask","forks_url":"https://api.github.com/repos/nirizr/dask/forks","keys_url":"https://api.github.com/repos/nirizr/dask/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nirizr/dask/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nirizr/dask/teams","hooks_url":"https://api.github.com/repos/nirizr/dask/hooks","issue_events_url":"https://api.github.com/repos/nirizr/dask/issues/events{/number}","events_url":"https://api.github.com/repos/nirizr/dask/events","assignees_url":"https://api.github.com/repos/nirizr/dask/assignees{/user}","branches_url":"https://api.github.com/repos/nirizr/dask/branches{/branch}","tags_url":"https://api.github.com/repos/nirizr/dask/tags","blobs_url":"https://api.github.com/repos/nirizr/dask/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nirizr/dask/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nirizr/dask/git/refs{/sha}","trees_url":"https://api.github.com/repos/nirizr/dask/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nirizr/dask/statuses/{sha}","languages_url":"https://api.github.com/repos/nirizr/dask/languages","stargazers_url":"https://api.github.com/repos/nirizr/dask/stargazers","contributors_url":"https://api.github.com/repos/nirizr/dask/contributors","subscribers_url":"https://api.github.com/repos/nirizr/dask/subscribers","subscription_url":"https://api.github.com/repos/nirizr/dask/subscription","commits_url":"https://api.github.com/repos/nirizr/dask/commits{/sha}","git_commits_url":"https://api.github.com/repos/nirizr/dask/git/commits{/sha}","comments_url":"https://api.github.com/repos/nirizr/dask/comments{/number}","issue_comment_url":"https://api.github.com/repos/nirizr/dask/issues/comments{/number}","contents_url":"https://api.github.com/repos/nirizr/dask/contents/{+path}","compare_url":"https://api.github.com/repos/nirizr/dask/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nirizr/dask/merges","archive_url":"https://api.github.com/repos/nirizr/dask/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nirizr/dask/downloads","issues_url":"https://api.github.com/repos/nirizr/dask/issues{/number}","pulls_url":"https://api.github.com/repos/nirizr/dask/pulls{/number}","milestones_url":"https://api.github.com/repos/nirizr/dask/milestones{/number}","notifications_url":"https://api.github.com/repos/nirizr/dask/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nirizr/dask/labels{/name}","releases_url":"https://api.github.com/repos/nirizr/dask/releases{/id}","deployments_url":"https://api.github.com/repos/nirizr/dask/deployments","created_at":"2016-05-30T10:24:02Z","updated_at":"2016-05-30T10:24:03Z","pushed_at":"2016-06-19T18:16:46Z","git_url":"git://github.com/nirizr/dask.git","ssh_url":"git@github.com:nirizr/dask.git","clone_url":"https://github.com/nirizr/dask.git","svn_url":"https://github.com/nirizr/dask","homepage":"http://dask.pydata.org","size":10645,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"dask:master","ref":"master","sha":"a7e7ef16475e0486f3d3e8e80016f9a23f62c710","user":{"login":"dask","id":17131925,"avatar_url":"https://avatars.githubusercontent.com/u/17131925?v=3","gravatar_id":"","url":"https://api.github.com/users/dask","html_url":"https://github.com/dask","followers_url":"https://api.github.com/users/dask/followers","following_url":"https://api.github.com/users/dask/following{/other_user}","gists_url":"https://api.github.com/users/dask/gists{/gist_id}","starred_url":"https://api.github.com/users/dask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dask/subscriptions","organizations_url":"https://api.github.com/users/dask/orgs","repos_url":"https://api.github.com/users/dask/repos","events_url":"https://api.github.com/users/dask/events{/privacy}","received_events_url":"https://api.github.com/users/dask/received_events","type":"Organization","site_admin":false},"repo":{"id":28782747,"name":"dask","full_name":"dask/dask","owner":{"login":"dask","id":17131925,"avatar_url":"https://avatars.githubusercontent.com/u/17131925?v=3","gravatar_id":"","url":"https://api.github.com/users/dask","html_url":"https://github.com/dask","followers_url":"https://api.github.com/users/dask/followers","following_url":"https://api.github.com/users/dask/following{/other_user}","gists_url":"https://api.github.com/users/dask/gists{/gist_id}","starred_url":"https://api.github.com/users/dask/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dask/subscriptions","organizations_url":"https://api.github.com/users/dask/orgs","repos_url":"https://api.github.com/users/dask/repos","events_url":"https://api.github.com/users/dask/events{/privacy}","received_events_url":"https://api.github.com/users/dask/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dask/dask","description":"Versatile parallel programming with task scheduling","fork":false,"url":"https://api.github.com/repos/dask/dask","forks_url":"https://api.github.com/repos/dask/dask/forks","keys_url":"https://api.github.com/repos/dask/dask/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dask/dask/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dask/dask/teams","hooks_url":"https://api.github.com/repos/dask/dask/hooks","issue_events_url":"https://api.github.com/repos/dask/dask/issues/events{/number}","events_url":"https://api.github.com/repos/dask/dask/events","assignees_url":"https://api.github.com/repos/dask/dask/assignees{/user}","branches_url":"https://api.github.com/repos/dask/dask/branches{/branch}","tags_url":"https://api.github.com/repos/dask/dask/tags","blobs_url":"https://api.github.com/repos/dask/dask/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dask/dask/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dask/dask/git/refs{/sha}","trees_url":"https://api.github.com/repos/dask/dask/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dask/dask/statuses/{sha}","languages_url":"https://api.github.com/repos/dask/dask/languages","stargazers_url":"https://api.github.com/repos/dask/dask/stargazers","contributors_url":"https://api.github.com/repos/dask/dask/contributors","subscribers_url":"https://api.github.com/repos/dask/dask/subscribers","subscription_url":"https://api.github.com/repos/dask/dask/subscription","commits_url":"https://api.github.com/repos/dask/dask/commits{/sha}","git_commits_url":"https://api.github.com/repos/dask/dask/git/commits{/sha}","comments_url":"https://api.github.com/repos/dask/dask/comments{/number}","issue_comment_url":"https://api.github.com/repos/dask/dask/issues/comments{/number}","contents_url":"https://api.github.com/repos/dask/dask/contents/{+path}","compare_url":"https://api.github.com/repos/dask/dask/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dask/dask/merges","archive_url":"https://api.github.com/repos/dask/dask/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dask/dask/downloads","issues_url":"https://api.github.com/repos/dask/dask/issues{/number}","pulls_url":"https://api.github.com/repos/dask/dask/pulls{/number}","milestones_url":"https://api.github.com/repos/dask/dask/milestones{/number}","notifications_url":"https://api.github.com/repos/dask/dask/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dask/dask/labels{/name}","releases_url":"https://api.github.com/repos/dask/dask/releases{/id}","deployments_url":"https://api.github.com/repos/dask/dask/deployments","created_at":"2015-01-04T18:50:00Z","updated_at":"2016-06-19T10:56:36Z","pushed_at":"2016-06-19T18:16:47Z","git_url":"git://github.com/dask/dask.git","ssh_url":"git@github.com:dask/dask.git","clone_url":"https://github.com/dask/dask.git","svn_url":"https://github.com/dask/dask","homepage":"http://dask.pydata.org","size":11762,"stargazers_count":755,"watchers_count":755,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":131,"mirror_url":null,"open_issues_count":81,"forks":131,"open_issues":81,"watchers":755,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dask/dask/pulls/1303"},"html":{"href":"https://github.com/dask/dask/pull/1303"},"issue":{"href":"https://api.github.com/repos/dask/dask/issues/1303"},"comments":{"href":"https://api.github.com/repos/dask/dask/issues/1303/comments"},"review_comments":{"href":"https://api.github.com/repos/dask/dask/pulls/1303/comments"},"review_comment":{"href":"https://api.github.com/repos/dask/dask/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dask/dask/pulls/1303/commits"},"statuses":{"href":"https://api.github.com/repos/dask/dask/statuses/2fce1e7ba3be3b0d3483ed1161361c23ad0c0a4d"}}}}
{"actor":{"display_login":"nirizr"}}