3
I’m trying to analyze some shoe sales data, but I’m having a hard time creating a function to find out which number the customer bought the most in the previous year.
I have a table with this data:
Cód. Cliente CPF Nome Sexo Tamanho
5879099 37513584800 LOJA MASCULINO 35
5879099 37513584800 LOJA MASCULINO 23
5879099 37513584800 LOJA MASCULINO 17
5879099 37513584800 LOJA MASCULINO 37
5879099 37513584800 LOJA MASCULINO 17
3353800 2613618809 DULIO JOSE DE SOUSA DAMICO MASCULINO 35
3353800 2613618809 DULIO JOSE DE SOUSA DAMICO MASCULINO 39
3112300 29953652805 ROSANA DA SILVA FAGUNDES FEMININO 34
6116202 39285701884 ANA CAROLINA DE FARIAS FRANCISCO FEMININO 31
The table is much more than this, just a few example lines.
Well, what I need to know is which size is the most repeated by customer number.
Which number did he buy the most?
I couldn’t find a way to do that if someone had a light.
Thank you,
It would be something like
df['Tamanho'].value_counts().idxmax()
?– Woss
@Andersoncarloswoss believe that something like this, but for each CPF, I would have to create a single CPF column and a function to pick up the idmax by Cpf?
– Iuri Moura