Skip to content

Conversation

nickeubank
Copy link
Contributor

Closes Issue #11814

Several pandas operations create objects that share _data objects. In particular, all of the following result in df_news and df sharing the same _data (i.e. df_new._data is df._data returns True).

df = DataFrame({'col1':[0,1,2], 'col2':[2,3,4]})
df_new = DataFrame(df)
df_new1 = df.loc[:,:]
df_new2 = df.iloc[:,:]

Needed for PR #11500

@@ -217,6 +217,7 @@ def __init__(self, data=None, index=None, columns=None, dtype=None,
dtype = self._validate_dtype(dtype)

if isinstance(data, DataFrame):
data = data.iloc[:,:]
data = data._data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to define BlockManager.view() this will do all of the heavy lifting, everything else will flow from there

@jreback jreback added the Internals Related to non-user accessible pandas implementation label Dec 16, 2015
@jreback
Copy link
Contributor

jreback commented Jan 11, 2016

xref #11970

this idea will be incorporated there.

If you want to update before then (as this might take a while), feel free to reopen.

@jreback jreback closed this Jan 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internals Related to non-user accessible pandas implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants