Dec-12-2020, 08:06 PM
sorted_data = df.sort_values(by="Hombres", ascending=True)
or
df.sort_values(by="Hombres", ascending=True, inplace=True)
It depends on if you only want sorted data for the plot, or if you want the dataframe sorted. If you do not specify inplace=True the sort_values function creates and returns a new dataframe. The original dataframe is not changed.
or
df.sort_values(by="Hombres", ascending=True, inplace=True)
It depends on if you only want sorted data for the plot, or if you want the dataframe sorted. If you do not specify inplace=True the sort_values function creates and returns a new dataframe. The original dataframe is not changed.