Below is df, I need to analyze the data.
gender dob list
0 M 01/01/87 [['Office/Work'],['31-35'], ['Salaried']]
1 M 01/01/94 [[Movies,Restaurants'],['21-25'], ['Salaried']]
2 M 01/01/95 [['College/Park'],['21-25'],['Student']]
3 F 01/01/97 [['College'], ['21-25'], ['Student']]
Expected Out 1. I need to analyse how many salaried are there in the dataset
df['salaried']
Total = 2,
Male = 2,
Female = 0
- How many student are there in the list df['students']
Total = 2,
Male = 1,
Female = 1
- How many are going to Movies df['Movies']
Total = 1,
Male = 1,
Female=0
Group by different age group df['age_group']
Age_Group Total Male Female ['21-25'] 3 2 1 ['31-35'] 1 1 0
What is the percentage of Male to Female
round(len(df.loc[df['gender'] == 'M']) / (len(df.loc[df['gender'] == 'M']) + len(df.loc[df['gender'] == 'F'])),2)*100