A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/15622 below:

sort_index doesn't work after concat · Issue #15622 · pandas-dev/pandas · GitHub

The sort_index method does not seem to work properly if the dataframe was created with concat. See this example:

>>> df = pd.DataFrame(index=['a', 'b'])
>>> pd.concat([df, df], keys=[0.8, 0.5]).sort_index()
Empty DataFrame
Columns: []
Index: [(0.8, a), (0.8, b), (0.5, a), (0.5, b)]

The 0.5 tuples should come before the 0.8 ones. Everything works fine if I create the multi-index from a product:

>>> pd.DataFrame(index=pd.MultiIndex.from_product([[0.8, 0.5], ['a', 'b']]))
Empty DataFrame
Columns: []
Index: [(0.8, a), (0.8, b), (0.5, a), (0.5, b)]
>>> pd.DataFrame(index=pd.MultiIndex.from_product([[0.8, 0.5], ['a', 'b']])).sort_index()
Empty DataFrame
Columns: []
Index: [(0.5, a), (0.5, b), (0.8, a), (0.8, b)]

I'm on pandas version 0.18.1.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4