{"action":"created","comment":{"url":"https://api.github.com/repos/biolab/orange3/pulls/comments/68040087","id":68040087,"diff_hunk":"@@ -33,146 +28,176 @@ def get_sample_datasets_dir():\n dataset_dirs = ['', get_sample_datasets_dir()]\n \n \n-class RowInstance(Instance):\n-    sparse_x = None\n-    sparse_y = None\n-    sparse_metas = None\n-    _weight = None\n+class Role:\n+    \"\"\"\n+    An enum of variable roles, provided for static convenience and a parser. \n+    \"\"\"\n+    # enum values\n+    x, y, meta = \"x\", \"y\", \"meta\"\n \n-    def __init__(self, table, row_index):\n-        \"\"\"\n-        Construct a data instance representing the given row of the table.\n-        \"\"\"\n-        self.table = table\n-        self._domain = table.domain\n-        self.row_index = row_index\n-        self.id = table.ids[row_index]\n-        self._x = table.X[row_index]\n-        if sp.issparse(self._x):\n-            self.sparse_x = self._x\n-            self._x = np.asarray(self._x.todense())[0]\n-        self._y = table._Y[row_index]\n-        if sp.issparse(self._y):\n-            self.sparse_y = self._y\n-            self._y = np.asarray(self._y.todense())[0]\n-        self._metas = table.metas[row_index]\n-        if sp.issparse(self._metas):\n-            self.sparse_metas = self._metas\n-            self._metas = np.asarray(self._metas.todense())[0]\n+    # parsing map, also aliases\n+    _mappings = {\"data\": x, \"target\": y, x: x, y: y, meta: meta}\n \n-    @property\n-    def weight(self):\n-        if not self.table.has_weights():\n-            return 1\n-        return self.table.W[self.row_index]\n-\n-    @weight.setter\n-    def weight(self, weight):\n-        if not self.table.has_weights():\n-            self.table.set_weights()\n-        self.table.W[self.row_index] = weight\n-\n-    def set_class(self, value):\n-        self._check_single_class()\n-        if not isinstance(value, Real):\n-            value = self.table.domain.class_var.to_val(value)\n-        self._y[0] = value\n-        if self.sparse_y:\n-            self.table._Y[self.row_index, 0] = value\n+    @staticmethod\n+    def from_string(role_string):\n+        role_string = role_string.strip(\"s \")  # simple plurality, whitespace\n+        return Role._mappings.get(role_string)\n \n-    def __setitem__(self, key, value):\n-        if not isinstance(key, Integral):\n-            key = self._domain.index(key)\n-        if isinstance(value, str):\n-            var = self._domain[key]\n-            value = var.to_val(value)\n-        if key >= 0:\n-            if not isinstance(value, Real):\n-                raise TypeError(\"Expected primitive value, got '%s'\" %\n-                                type(value).__name__)\n-            if key < len(self._x):\n-                self._x[key] = value\n-                if self.sparse_x:\n-                    self.table.X[self.row_index, key] = value\n-            else:\n-                self._y[key - len(self._x)] = value\n-                if self.sparse_y:\n-                    self.table._Y[self.row_index, key - len(self._x)] = value\n-        else:\n-            self._metas[-1 - key] = value\n-            if self.sparse_metas:\n-                self.table.metas[self.row_index, -1 - key] = value\n-\n-    def _str(self, limit):\n-        def sp_values(matrix, variables):\n-            if not sp.issparse(matrix):\n-                return Instance.str_values(matrix[row], variables, limit)\n-            begptr, endptr = matrix.indptr[row:row + 2]\n-            rendptr = endptr if not limit else min(endptr, begptr + 5)\n-            variables = [variables[var]\n-                         for var in matrix.indices[begptr:rendptr]]\n-            s = \", \".join(\n-                \"{}={}\".format(var.name, var.str_val(val))\n-                for var, val in zip(variables, matrix.data[begptr:rendptr]))\n-            if limit and rendptr != endptr:\n-                s += \", ...\"\n-            return s\n-\n-        table = self.table\n-        domain = table.domain\n-        row = self.row_index\n-        s = \"[\" + sp_values(table.X, domain.attributes)\n-        if domain.class_vars:\n-            s += \" | \" + sp_values(table._Y, domain.class_vars)\n-        s += \"]\"\n-        if self._domain.metas:\n-            s += \" {\" + sp_values(table.metas, domain.metas) + \"}\"\n-        return s\n \n-    def __str__(self):\n-        return self._str(False)\n+# noinspection PyPep8Naming\n+class Table(Storage, DataFrame):","path":"Orange/data/table.py","position":151,"original_position":151,"commit_id":"f38001b4895ddeab11a0b1550f4e1dac97faf5dd","original_commit_id":"f38001b4895ddeab11a0b1550f4e1dac97faf5dd","user":{"login":"sstanovnik","id":8071628,"avatar_url":"https://avatars.githubusercontent.com/u/8071628?v=3","gravatar_id":"","url":"https://api.github.com/users/sstanovnik","html_url":"https://github.com/sstanovnik","followers_url":"https://api.github.com/users/sstanovnik/followers","following_url":"https://api.github.com/users/sstanovnik/following{/other_user}","gists_url":"https://api.github.com/users/sstanovnik/gists{/gist_id}","starred_url":"https://api.github.com/users/sstanovnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sstanovnik/subscriptions","organizations_url":"https://api.github.com/users/sstanovnik/orgs","repos_url":"https://api.github.com/users/sstanovnik/repos","events_url":"https://api.github.com/users/sstanovnik/events{/privacy}","received_events_url":"https://api.github.com/users/sstanovnik/received_events","type":"User","site_admin":false},"body":"Likely none. I just haven't gotten around to Storage yet. ","created_at":"2016-06-22T12:00:57Z","updated_at":"2016-06-22T12:00:58Z","html_url":"https://github.com/biolab/orange3/pull/1347#discussion_r68040087","pull_request_url":"https://api.github.com/repos/biolab/orange3/pulls/1347","_links":{"self":{"href":"https://api.github.com/repos/biolab/orange3/pulls/comments/68040087"},"html":{"href":"https://github.com/biolab/orange3/pull/1347#discussion_r68040087"},"pull_request":{"href":"https://api.github.com/repos/biolab/orange3/pulls/1347"}}},"pull_request":{"url":"https://api.github.com/repos/biolab/orange3/pulls/1347","id":74257124,"html_url":"https://github.com/biolab/orange3/pull/1347","diff_url":"https://github.com/biolab/orange3/pull/1347.diff","patch_url":"https://github.com/biolab/orange3/pull/1347.patch","issue_url":"https://api.github.com/repos/biolab/orange3/issues/1347","number":1347,"state":"open","locked":false,"title":"[WIP] pandas migration","user":{"login":"sstanovnik","id":8071628,"avatar_url":"https://avatars.githubusercontent.com/u/8071628?v=3","gravatar_id":"","url":"https://api.github.com/users/sstanovnik","html_url":"https://github.com/sstanovnik","followers_url":"https://api.github.com/users/sstanovnik/followers","following_url":"https://api.github.com/users/sstanovnik/following{/other_user}","gists_url":"https://api.github.com/users/sstanovnik/gists{/gist_id}","starred_url":"https://api.github.com/users/sstanovnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sstanovnik/subscriptions","organizations_url":"https://api.github.com/users/sstanovnik/orgs","repos_url":"https://api.github.com/users/sstanovnik/repos","events_url":"https://api.github.com/users/sstanovnik/events{/privacy}","received_events_url":"https://api.github.com/users/sstanovnik/received_events","type":"User","site_admin":false},"body":"This is the giant (well, WIP) pull request for converting the existing architecture to `pandas`. \r\nSee [this wiki page](https://github.com/biolab/orange3/wiki/pandas-migration) and [this Google Sheet](https://docs.google.com/spreadsheets/d/1yAGeUYut71Imd1c0YGgqp-QgmwtCQZfm9fat_mHvGcQ/edit?usp=sharing) for comments on more general architectural decisions. \r\n\r\nSo far, the majority of the additional new API is done, but few functions actually work and none have been tested. This will break until I start writing tests and modifying existing code. Todos and progress, along with code examples, is monitored in the Gsheet. ","created_at":"2016-06-17T15:03:49Z","updated_at":"2016-06-22T12:00:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f53f71da84bc8ea8b3de656aede49f7ae6c3797","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/biolab/orange3/pulls/1347/commits","review_comments_url":"https://api.github.com/repos/biolab/orange3/pulls/1347/comments","review_comment_url":"https://api.github.com/repos/biolab/orange3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/biolab/orange3/issues/1347/comments","statuses_url":"https://api.github.com/repos/biolab/orange3/statuses/f38001b4895ddeab11a0b1550f4e1dac97faf5dd","head":{"label":"sstanovnik:koalas","ref":"koalas","sha":"f38001b4895ddeab11a0b1550f4e1dac97faf5dd","user":{"login":"sstanovnik","id":8071628,"avatar_url":"https://avatars.githubusercontent.com/u/8071628?v=3","gravatar_id":"","url":"https://api.github.com/users/sstanovnik","html_url":"https://github.com/sstanovnik","followers_url":"https://api.github.com/users/sstanovnik/followers","following_url":"https://api.github.com/users/sstanovnik/following{/other_user}","gists_url":"https://api.github.com/users/sstanovnik/gists{/gist_id}","starred_url":"https://api.github.com/users/sstanovnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sstanovnik/subscriptions","organizations_url":"https://api.github.com/users/sstanovnik/orgs","repos_url":"https://api.github.com/users/sstanovnik/repos","events_url":"https://api.github.com/users/sstanovnik/events{/privacy}","received_events_url":"https://api.github.com/users/sstanovnik/received_events","type":"User","site_admin":false},"repo":{"id":58224040,"name":"orange3","full_name":"sstanovnik/orange3","owner":{"login":"sstanovnik","id":8071628,"avatar_url":"https://avatars.githubusercontent.com/u/8071628?v=3","gravatar_id":"","url":"https://api.github.com/users/sstanovnik","html_url":"https://github.com/sstanovnik","followers_url":"https://api.github.com/users/sstanovnik/followers","following_url":"https://api.github.com/users/sstanovnik/following{/other_user}","gists_url":"https://api.github.com/users/sstanovnik/gists{/gist_id}","starred_url":"https://api.github.com/users/sstanovnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sstanovnik/subscriptions","organizations_url":"https://api.github.com/users/sstanovnik/orgs","repos_url":"https://api.github.com/users/sstanovnik/repos","events_url":"https://api.github.com/users/sstanovnik/events{/privacy}","received_events_url":"https://api.github.com/users/sstanovnik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sstanovnik/orange3","description":"Orange 3 data mining suite: http://orange.biolab.si ","fork":true,"url":"https://api.github.com/repos/sstanovnik/orange3","forks_url":"https://api.github.com/repos/sstanovnik/orange3/forks","keys_url":"https://api.github.com/repos/sstanovnik/orange3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sstanovnik/orange3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sstanovnik/orange3/teams","hooks_url":"https://api.github.com/repos/sstanovnik/orange3/hooks","issue_events_url":"https://api.github.com/repos/sstanovnik/orange3/issues/events{/number}","events_url":"https://api.github.com/repos/sstanovnik/orange3/events","assignees_url":"https://api.github.com/repos/sstanovnik/orange3/assignees{/user}","branches_url":"https://api.github.com/repos/sstanovnik/orange3/branches{/branch}","tags_url":"https://api.github.com/repos/sstanovnik/orange3/tags","blobs_url":"https://api.github.com/repos/sstanovnik/orange3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sstanovnik/orange3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sstanovnik/orange3/git/refs{/sha}","trees_url":"https://api.github.com/repos/sstanovnik/orange3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sstanovnik/orange3/statuses/{sha}","languages_url":"https://api.github.com/repos/sstanovnik/orange3/languages","stargazers_url":"https://api.github.com/repos/sstanovnik/orange3/stargazers","contributors_url":"https://api.github.com/repos/sstanovnik/orange3/contributors","subscribers_url":"https://api.github.com/repos/sstanovnik/orange3/subscribers","subscription_url":"https://api.github.com/repos/sstanovnik/orange3/subscription","commits_url":"https://api.github.com/repos/sstanovnik/orange3/commits{/sha}","git_commits_url":"https://api.github.com/repos/sstanovnik/orange3/git/commits{/sha}","comments_url":"https://api.github.com/repos/sstanovnik/orange3/comments{/number}","issue_comment_url":"https://api.github.com/repos/sstanovnik/orange3/issues/comments{/number}","contents_url":"https://api.github.com/repos/sstanovnik/orange3/contents/{+path}","compare_url":"https://api.github.com/repos/sstanovnik/orange3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sstanovnik/orange3/merges","archive_url":"https://api.github.com/repos/sstanovnik/orange3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sstanovnik/orange3/downloads","issues_url":"https://api.github.com/repos/sstanovnik/orange3/issues{/number}","pulls_url":"https://api.github.com/repos/sstanovnik/orange3/pulls{/number}","milestones_url":"https://api.github.com/repos/sstanovnik/orange3/milestones{/number}","notifications_url":"https://api.github.com/repos/sstanovnik/orange3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sstanovnik/orange3/labels{/name}","releases_url":"https://api.github.com/repos/sstanovnik/orange3/releases{/id}","deployments_url":"https://api.github.com/repos/sstanovnik/orange3/deployments","created_at":"2016-05-06T17:35:01Z","updated_at":"2016-05-06T17:35:04Z","pushed_at":"2016-06-17T14:20:34Z","git_url":"git://github.com/sstanovnik/orange3.git","ssh_url":"git@github.com:sstanovnik/orange3.git","clone_url":"https://github.com/sstanovnik/orange3.git","svn_url":"https://github.com/sstanovnik/orange3","homepage":"","size":37529,"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":"biolab:master","ref":"master","sha":"1eb32ae17a2276b249b0b08215b4e1af0495ec96","user":{"login":"biolab","id":555189,"avatar_url":"https://avatars.githubusercontent.com/u/555189?v=3","gravatar_id":"","url":"https://api.github.com/users/biolab","html_url":"https://github.com/biolab","followers_url":"https://api.github.com/users/biolab/followers","following_url":"https://api.github.com/users/biolab/following{/other_user}","gists_url":"https://api.github.com/users/biolab/gists{/gist_id}","starred_url":"https://api.github.com/users/biolab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biolab/subscriptions","organizations_url":"https://api.github.com/users/biolab/orgs","repos_url":"https://api.github.com/users/biolab/repos","events_url":"https://api.github.com/users/biolab/events{/privacy}","received_events_url":"https://api.github.com/users/biolab/received_events","type":"Organization","site_admin":false},"repo":{"id":8357227,"name":"orange3","full_name":"biolab/orange3","owner":{"login":"biolab","id":555189,"avatar_url":"https://avatars.githubusercontent.com/u/555189?v=3","gravatar_id":"","url":"https://api.github.com/users/biolab","html_url":"https://github.com/biolab","followers_url":"https://api.github.com/users/biolab/followers","following_url":"https://api.github.com/users/biolab/following{/other_user}","gists_url":"https://api.github.com/users/biolab/gists{/gist_id}","starred_url":"https://api.github.com/users/biolab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biolab/subscriptions","organizations_url":"https://api.github.com/users/biolab/orgs","repos_url":"https://api.github.com/users/biolab/repos","events_url":"https://api.github.com/users/biolab/events{/privacy}","received_events_url":"https://api.github.com/users/biolab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/biolab/orange3","description":"Orange 3 data mining suite: http://orange.biolab.si ","fork":false,"url":"https://api.github.com/repos/biolab/orange3","forks_url":"https://api.github.com/repos/biolab/orange3/forks","keys_url":"https://api.github.com/repos/biolab/orange3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/biolab/orange3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/biolab/orange3/teams","hooks_url":"https://api.github.com/repos/biolab/orange3/hooks","issue_events_url":"https://api.github.com/repos/biolab/orange3/issues/events{/number}","events_url":"https://api.github.com/repos/biolab/orange3/events","assignees_url":"https://api.github.com/repos/biolab/orange3/assignees{/user}","branches_url":"https://api.github.com/repos/biolab/orange3/branches{/branch}","tags_url":"https://api.github.com/repos/biolab/orange3/tags","blobs_url":"https://api.github.com/repos/biolab/orange3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/biolab/orange3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/biolab/orange3/git/refs{/sha}","trees_url":"https://api.github.com/repos/biolab/orange3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/biolab/orange3/statuses/{sha}","languages_url":"https://api.github.com/repos/biolab/orange3/languages","stargazers_url":"https://api.github.com/repos/biolab/orange3/stargazers","contributors_url":"https://api.github.com/repos/biolab/orange3/contributors","subscribers_url":"https://api.github.com/repos/biolab/orange3/subscribers","subscription_url":"https://api.github.com/repos/biolab/orange3/subscription","commits_url":"https://api.github.com/repos/biolab/orange3/commits{/sha}","git_commits_url":"https://api.github.com/repos/biolab/orange3/git/commits{/sha}","comments_url":"https://api.github.com/repos/biolab/orange3/comments{/number}","issue_comment_url":"https://api.github.com/repos/biolab/orange3/issues/comments{/number}","contents_url":"https://api.github.com/repos/biolab/orange3/contents/{+path}","compare_url":"https://api.github.com/repos/biolab/orange3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/biolab/orange3/merges","archive_url":"https://api.github.com/repos/biolab/orange3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/biolab/orange3/downloads","issues_url":"https://api.github.com/repos/biolab/orange3/issues{/number}","pulls_url":"https://api.github.com/repos/biolab/orange3/pulls{/number}","milestones_url":"https://api.github.com/repos/biolab/orange3/milestones{/number}","notifications_url":"https://api.github.com/repos/biolab/orange3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/biolab/orange3/labels{/name}","releases_url":"https://api.github.com/repos/biolab/orange3/releases{/id}","deployments_url":"https://api.github.com/repos/biolab/orange3/deployments","created_at":"2013-02-22T12:52:56Z","updated_at":"2016-06-17T19:16:39Z","pushed_at":"2016-06-22T07:39:56Z","git_url":"git://github.com/biolab/orange3.git","ssh_url":"git@github.com:biolab/orange3.git","clone_url":"https://github.com/biolab/orange3.git","svn_url":"https://github.com/biolab/orange3","homepage":"","size":77478,"stargazers_count":303,"watchers_count":303,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":130,"mirror_url":null,"open_issues_count":41,"forks":130,"open_issues":41,"watchers":303,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/biolab/orange3/pulls/1347"},"html":{"href":"https://github.com/biolab/orange3/pull/1347"},"issue":{"href":"https://api.github.com/repos/biolab/orange3/issues/1347"},"comments":{"href":"https://api.github.com/repos/biolab/orange3/issues/1347/comments"},"review_comments":{"href":"https://api.github.com/repos/biolab/orange3/pulls/1347/comments"},"review_comment":{"href":"https://api.github.com/repos/biolab/orange3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/biolab/orange3/pulls/1347/commits"},"statuses":{"href":"https://api.github.com/repos/biolab/orange3/statuses/f38001b4895ddeab11a0b1550f4e1dac97faf5dd"}}}}
{"actor":{"display_login":"sstanovnik"}}