Closed
Description
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)