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

Can pd.DataFrame retain column order when passed in OrderedDict? #2455

Closed
dalejung opened this Issue Dec 8, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@dalejung
Contributor

dalejung commented Dec 8, 2012

It would have the nice effect of having

ohlc = OrderedDict()
ohlc['open'] = 'first'
ohlc['high'] = 'max'
ohlc['low'] = 'min'
ohlc['close'] = 'last'

gdf = grouped.agg(ohlc)

come out with the proper column order.

core/groupby.py

1593             else:                                                                               
1594                 result = DataFrame(result) 

result is ordered correctly before being passed to DataFrame constructor.

@wesm

This comment has been minimized.

Show comment
Hide comment
@wesm

wesm Dec 8, 2012

Member

Should be pretty trivial.

Member

wesm commented Dec 8, 2012

Should be pretty trivial.

wesm added a commit that referenced this issue Dec 8, 2012

Merge remote branch 'y-p/2455'
* y-p/2455:
  BUG: further hash randomization fixes in test_groupby
  DOC: update RELEASE.rst
  BUG: DataFrame ctor should respect col order when given OrderedDict #2455
  TST: DataFrame ctor should respect col order when given OrderedDict

@wesm wesm closed this Dec 8, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment