{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/11207","labels_url":"https://api.github.com/repos/pydata/pandas/issues/11207/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/11207/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/11207/events","html_url":"https://github.com/pydata/pandas/pull/11207","id":109138129,"number":11207,"title":"Simple copy on write skeleton","user":{"login":"nickeubank","id":9683693,"avatar_url":"https://avatars.githubusercontent.com/u/9683693?v=3","gravatar_id":"","url":"https://api.github.com/users/nickeubank","html_url":"https://github.com/nickeubank","followers_url":"https://api.github.com/users/nickeubank/followers","following_url":"https://api.github.com/users/nickeubank/following{/other_user}","gists_url":"https://api.github.com/users/nickeubank/gists{/gist_id}","starred_url":"https://api.github.com/users/nickeubank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickeubank/subscriptions","organizations_url":"https://api.github.com/users/nickeubank/orgs","repos_url":"https://api.github.com/users/nickeubank/repos","events_url":"https://api.github.com/users/nickeubank/events{/privacy}","received_events_url":"https://api.github.com/users/nickeubank/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-09-30T17:11:45Z","updated_at":"2015-10-02T18:12:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pydata/pandas/pulls/11207","html_url":"https://github.com/pydata/pandas/pull/11207","diff_url":"https://github.com/pydata/pandas/pull/11207.diff","patch_url":"https://github.com/pydata/pandas/pull/11207.patch"},"body":"Aims to eventually close #10954 , alternative to #10973 \r\n\r\nIn the interest of advancing the discussion on this, here's a skeleton of a different copy on write implementation. \r\n\r\n**Currently**\r\n\r\nWhen setting on a view, converts to copy. \r\n\r\n     df = pd.DataFrame({'col1':[1,2], 'col2':[3,4]})\r\n     intermediate = df.loc[1:1,]\r\n     intermediate['col1'] = -99\r\n    \r\n    \r\n    intermediate\r\n    \r\n    Out[8]: \r\n       col1  col2\r\n    1   -99     4\r\n    \r\n    df\r\n    \r\n    Out[9]: \r\n       col1  col2\r\n    0     1     3\r\n    1     2     4\r\n\r\nChained-indexing will ALWAYS fail. \r\n\r\n    df = pd.DataFrame({'col1':[1,2], 'col2':[3,4]})\r\n    df.loc[1:1,]['col1'] = -99\r\n    df\r\n    \r\n    Out[11]: \r\n       col1  col2\r\n    1     2     4\r\n\r\n`SettingWithCopy` warning disabled, thought not fully removed (figure this is too early stage to really chase that down). \r\n\r\nForward Protection for `loc` setting (proof of concept, added oct 2):\r\n\r\n     df = pd.DataFrame({'col1':[1,2], 'col2':[3,4]})\r\n     intermediate = df.loc[1:1,]\r\n\r\n     df.loc[1,'col1'] = -99\r\n     intermediate\r\n  \r\n      Out[11]: \r\n       col1  col2\r\n    0     1     3\r\n    1     2     4\r\n\r\n\r\n**Goals / Places I'd love help**\r\n* We've discussed keeps full-column slices as views, since we can guarantee these will always be views. I created an attribute called `_is_column_view` that can be set to `True` when a slice is a full column (e.g. `new = df['col1']`, but I'm not sure how to actually figure out if a slice is a full column, so right now it's initialized as `False` and just stays that way. \r\n* This has no protection against forward propagation -- situations where one sets values on a Frame and they propagate to views of that Frame. There IS a framework to address it, but it's incomplete. As it stands:\r\n  * Frames now have a `_children` list attribute to keep references to their child `views`.\r\n  * Before setting, there's a call to a function to try and convert the children from `views` to `copies`. \r\nBut as it stand, I don't know how to really manage those references (i.e. how to put references to children in that `_children` list). \r\n\r\n\r\n@jreback \r\n@shoyer \r\n@JanSchulz \r\n@TomAugspurger \r\n"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/145111732","html_url":"https://github.com/pydata/pandas/pull/11207#issuecomment-145111732","issue_url":"https://api.github.com/repos/pydata/pandas/issues/11207","id":145111732,"user":{"login":"nickeubank","id":9683693,"avatar_url":"https://avatars.githubusercontent.com/u/9683693?v=3","gravatar_id":"","url":"https://api.github.com/users/nickeubank","html_url":"https://github.com/nickeubank","followers_url":"https://api.github.com/users/nickeubank/followers","following_url":"https://api.github.com/users/nickeubank/following{/other_user}","gists_url":"https://api.github.com/users/nickeubank/gists{/gist_id}","starred_url":"https://api.github.com/users/nickeubank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickeubank/subscriptions","organizations_url":"https://api.github.com/users/nickeubank/orgs","repos_url":"https://api.github.com/users/nickeubank/repos","events_url":"https://api.github.com/users/nickeubank/events{/privacy}","received_events_url":"https://api.github.com/users/nickeubank/received_events","type":"User","site_admin":false},"created_at":"2015-10-02T18:12:10Z","updated_at":"2015-10-02T18:12:10Z","body":"@shoyer would you mind explaining a little more? You mean just a floating global dictionary as opposed to an object attribute?\r\n\r\nMain problem I'm having now (love suggestions @jreback @shoyer ): where to place `_convert_children()` call. Is there a single function that's *always* called when data is changed where I can put it? Or a short list of functions where it should be put? "}}