Skip to content

Column reappears after drop() when working on a reference of that column #13934

Closed
@Gunthard

Description

@Gunthard

Code Sample, a copy-pastable example if possible

import pandas

df = pandas.DataFrame()
df['a'] = [1,2,3]

a = df.a

df.drop(['a'], axis=1, inplace=True)
print df.columns

a -= a.mean()
print df.columns

Current Output

Index([], dtype='object')
Index([u'a'], dtype='object')

Expected Output

Index([], dtype='object')
Index([], dtype='object')

output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 3.19.0-65-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: de_DE.UTF-8

pandas: 0.18.1
nose: 1.3.7
pip: 1.5.4
setuptools: 20.9.0
Cython: 0.23.4
numpy: 1.11.1
scipy: 0.17.1
statsmodels: 0.6.1
xarray: None
IPython: 4.0.0
sphinx: 1.3.5
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.0
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
httplib2: 0.8
apiclient: None
sqlalchemy: 1.0.11
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.38.0
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions