Skip to content
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

BUG: wide_to_long modifies stubnames #9204

Closed
jtorcasso opened this issue Jan 6, 2015 · 3 comments
Closed

BUG: wide_to_long modifies stubnames #9204

jtorcasso opened this issue Jan 6, 2015 · 3 comments
Labels
Milestone

Comments

@jtorcasso
Copy link
Contributor

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']
@shoyer shoyer added the Bug label Jan 7, 2015
@shoyer shoyer added this to the 0.16.0 milestone Jan 7, 2015
@shoyer
Copy link
Member

shoyer commented Jan 7, 2015

Thanks for the report! I reproduced this with 0.15.2.

If you're feeling up for it, would love to get a PR with a fix. Should be pretty simple, I think.

@jtorcasso
Copy link
Contributor Author

Sure, I can do this. I'll submit by the end of this week.

@jreback
Copy link
Contributor

jreback commented Jan 18, 2015

closed by #9215

@jreback jreback closed this as completed Jan 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants