0
I have a dataframe and I want to organize the data by the frequency of appearance of each element. From the most repeated to the least repeated, to create a ranking. I want the organization to be made from the columns uf
and tipo_acidente
acidentes2020 = pd.read_csv('https://arquivos.prf.gov.br/arquivos/index.php/s/jdDLrQIf33xXSCe/download', compression='zip',encoding='iso8859-1', sep=';')
ranking2020 = acidentes2020[['uf', 'tipo_acidente']]
do you just want to draw the notes? If yes, see the method
sort_values
: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.sort_values.html. If you want to group the values before ranking, usegroupby
: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.groupby.html– Lucas
sorry, my question was mistaken. I really want to rank. For example: I want you to show the
tipo_acidente
that most occurred for determineduf
.– pauloguilherme