You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I will be happy to write up a pull request, but first wanted to gauge the sanity of my suggestion:
I think that swaplevel() deserves default values for its parameters, just like its friends like stack() and unstack() and sortlevel() that also all take an initial level argument. I suggest:
def swaplevel(self, i=-2, j=-1, axis=0):
This provides the greatest symmetry with the other methods that operate on levels: they all, if no level is specified, operate on the innermost level as their default.
In the very common case where there are only two levels to the multi-index anyway, this would reduce this frequent operation to simply .swaplevel() or .swaplevel(axis='columns') without, I don't think, any more loss of readability than when stack() or unstack() fail to specify the level upon which they are operating.
The text was updated successfully, but these errors were encountered:
I will be happy to write up a pull request, but first wanted to gauge the sanity of my suggestion:
I think that
swaplevel()
deserves default values for its parameters, just like its friends likestack()
andunstack()
andsortlevel()
that also all take an initiallevel
argument. I suggest:This provides the greatest symmetry with the other methods that operate on levels: they all, if no level is specified, operate on the innermost level as their default.
In the very common case where there are only two levels to the multi-index anyway, this would reduce this frequent operation to simply
.swaplevel()
or.swaplevel(axis='columns')
without, I don't think, any more loss of readability than whenstack()
orunstack()
fail to specify the level upon which they are operating.The text was updated successfully, but these errors were encountered: