In Daru, I know that by Daru::DataFrame#sort
we can sort dataframe by its column, but I noticed method does not work if we want to sort dataframe by its index.
Question
- I believe
Daru::DataFrame#sort
is for sorting by column. How can I sort a dataframe by index?
Looking at the Daru::DataFrame source it looks like there are several methods for iterating through the frame by index, such as
each_index
.There's also a method for reindexing: Daru::DataFrame#reindex which I believe could be used to replace the current index with a new index that you could build by sorting the old index with
index.sort
:Disclaimer: I don't know what a dataframe is or what daru does or what the indexes look like.