BUG: wide_to_long modifies stubnames · Issue #9204 · pandas-dev/pandas (original) (raw)

This is not a serious issue, but the list of stubnames passed into wide_to_long is modified by the function call.

INSTALLED VERSIONS

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

pandas: 0.15.1
nose: 1.3.1
Cython: None
numpy: 1.9.1
scipy: 0.14.0
statsmodels: 0.5.0
IPython: 1.2.1
sphinx: 1.2.2
patsy: 0.2.1
dateutil: 2.3
pytz: 2014.10
bottleneck: None
tables: None
numexpr: 2.2.2
matplotlib: 1.3.1
openpyxl: 1.7.0
xlrd: 0.9.2
xlwt: 0.7.5
xlsxwriter: None
lxml: 3.3.3
bs4: 4.2.1
html5lib: 0.999
httplib2: 0.8
apiclient: None
rpy2: 2.5.2
sqlalchemy: None
pymysql: None
psycopg2: None

import pandas as pd df = pd.DataFrame([[0,1,2,3,8],[4,5,6,7,9]]) df.columns = ['id', 'inc1', 'inc2', 'edu1', 'edu2'] df id inc1 inc2 edu1 edu2 0 0 1 2 3 8 1 4 5 6 7 9 stubs = ['inc', 'edu'] df_long = pd.wide_to_long(df, stubs, i='id', j='age') df_long inc edu id age
0 1 1 3 4 1 5 7 0 2 2 8 4 2 6 9 stubs ['edu']