diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 3c1942e300729..bc80988eb612c 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -74,6 +74,7 @@ class NDFrame(PandasObject): '_data', 'name', '_cacher', '_is_copy', '_subtyp', '_index', '_default_kind', '_default_fill_value'] _internal_names_set = set(_internal_names) _metadata = [] + _is_copy = None def __init__(self, data, axes=None, copy=False, dtype=None, fastpath=False): diff --git a/pandas/tests/test_indexing.py b/pandas/tests/test_indexing.py index d6d340a695231..dacac6ef64b29 100644 --- a/pandas/tests/test_indexing.py +++ b/pandas/tests/test_indexing.py @@ -1736,6 +1736,16 @@ def f(): df = DataFrame({'A':['aaa','bbb','ccc'],'B':[1,2,3]}) df.loc[0]['A'] = 111 + # make sure that _is_copy is picked up reconstruction + # GH5475 + df = DataFrame({"A": [1,2]}) + self.assert_(df._is_copy is False) + with tm.ensure_clean('__tmp__pickle') as path: + df.to_pickle(path) + df2 = pd.read_pickle(path) + df2["B"] = df2["A"] + df2["B"] = df2["A"] + def test_floating_index_doc_example(self): index = Index([1.5, 2, 3, 4.5, 5])