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/12397 below:

Add to_dataframe() method to MultiIndex · Issue #12397 · pandas-dev/pandas · GitHub

I find the Index.to_series method is a convenient way to allow indices to act as columns of a dataframe where desired. However, the behavior of MultiIndex.to_series, which gives a Series of tuples, is less useful.

Would it be convenient to provide a to_dataframe method for index classes? This would be a natural extension of the utility of to_series, and more useful for MultiIndex objects I would think.

I'm something equivalent to:

def to_dataframe(self):
   DataFrame(self.tolist(), columns=self.names, index=self)

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