Pandas: how to sort dataframe by column AND by index
https://stackoverflow.com/questions/4935470218.03.2018 · Given the DataFrame: import pandas as pd df = pd.DataFrame([6, 4, 2, 4, 5], index=[2, 6, 3, 4, 5], columns=['A']) Results in: A 2 6 6 4 3 2 4 4 5 5 Now, I would like to sort by values of
pandas.Series.sort_index — pandas 1.3.5 documentation
pandas.pydata.org › pandaspandas.Series.sort_index¶ Series. sort_index (axis = 0, level = None, ascending = True, inplace = False, kind = 'quicksort', na_position = 'last', sort_remaining = True, ignore_index = False, key = None) [source] ¶ Sort Series by index labels. Returns a new Series sorted by label if inplace argument is False, otherwise updates the original ...