-
-
Notifications
You must be signed in to change notification settings - Fork 17.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataFrame.copy(deep=True) dosen't deep copy the value which type is list() #22203
Comments
Semantically speaking, |
In the second case, if the contained series has dtype object, then this is behaving as documented. From the “Notes” section of the
|
In the first case, I don't think there is any actual aliasing going on. It only appears this way because of how you are checking with the (By the way, this example would be clearer if it did not recycle the names The example shows:
The first line (
the Python interpreter could perform the following steps:
If the temporary object created in step 1 is GC'ed in between, the temporary object created in step 3 may be created at the same address. (In CPython, the One case see examples of this just using plain old Python objects:
I think this issue should be closed as not-a-bug, unless I am missing something in the original report. |
@nmusolino you are right. It's literally not a bug. Thx! |
Code Sample, a copy-pastable example if possible
Problem description
When the type of values is list(), DataFrame.copy(deep=True) doesn't work as expected,
or is it a meaningless problem and is it not necessary to fix this?
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.1.final.0
python-bits: 64
OS: Darwin
OS-release: 17.7.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.23.4
pytest: 3.0.7
pip: 18.0
setuptools: 38.2.4
Cython: 0.25.2
numpy: 1.13.3
scipy: 0.19.0
pyarrow: None
xarray: None
IPython: 6.2.1
sphinx: 1.5.6
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: 1.2.1
tables: 3.3.0
numexpr: 2.6.2
feather: None
matplotlib: 2.1.1
openpyxl: 2.4.7
xlrd: 1.0.0
xlwt: 1.2.0
xlsxwriter: 0.9.6
lxml: 3.7.3
bs4: 4.6.0
html5lib: 0.9999999
sqlalchemy: 1.1.9
pymysql: None
psycopg2: 2.7.5 (dt dec pq3 ext lo64)
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: