Skip to content

Gabrielreid pandas multiindex handling bug - #5634

Merged
bashtage merged 2 commits into
statsmodels:masterfrom
bashtage:gabrielreid-pandas_multiindex_handling_bug
May 6, 2019
Merged

bashtage merged 2 commits into
statsmodels:masterfrom
bashtage:gabrielreid-pandas_multiindex_handling_bug

Conversation

@bashtage

@bashtage bashtage commented May 6, 2019

Copy link
Copy Markdown
Member

Gabriel Reid and others added 2 commits May 6, 2019 21:12
Flatten pandas MultiIndexes when extracting column names in the
data module. Prior to this commit, the MultiIndexes would be
exposed as a list of tuples, which would then result in the
DataFrame being treated as having more than 2 dimensions.

Fixes statsmodels#5414.
Use _ to make a python name
Clean up for flake compliance

closes statsmodels#5415
@bashtage
bashtage force-pushed the gabrielreid-pandas_multiindex_handling_bug branch from 204064f to e32be0b Compare May 6, 2019 20:12
Comment thread statsmodels/base/data.py
return ['_'.join((level for level in c if level))
for c in arr.columns]
else:
return list(arr.columns)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a (fairly new) MUktiIndex method for this. Oventuakly we should just use that

@bashtage
bashtage merged commit 2b97c82 into statsmodels:master May 6, 2019
@bashtage
bashtage deleted the gabrielreid-pandas_multiindex_handling_bug branch May 7, 2019 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants