Applied and view jobs ratio

I have the following data set where the column kind can be V(view) or A(apply), how can I do the following things given a particular job id how many applicant Apply (A) to that particular job and how many applicant View(V) the particular job? So I want a column with job and two columns with One labled view other labelled A for the job type. I am working in Jupyter notebook python, pandas, if someone can initiate or show me similar code will be really helpful


event_datetime  resume_id   job_id  event_platform  kind    Time    Date
0   2021-05-01 08:42:05 158655  38820886    IOS_APP V   08:42:05    2021-05-01
1   2021-05-01 08:42:05 158655  38901970    IOS_APP V   08:42:05    2021-05-01
2   2021-05-01 08:42:05 158655  38919645    IOS_APP V   08:42:05    2021-05-01
3   2021-05-01 08:42:05 158655  38928402    IOS_APP V   08:42:05    2021-05-01
4   2021-05-01 08:42:05 158655  38847632    IOS_APP V   08:42:05    2021-05-01
5   2021-05-01 08:42:05 158655  38892709    IOS_APP V   08:42:05    2021-05-01
6   2021-05-01 08:42:05 158655  38987246    IOS_APP V   08:42:05    2021-05-01
7   2021-05-01 08:42:05 158655  38983852    IOS_APP V   08:42:05    2021-05-01
8   2021-05-01 08:42:05 158655  38970661    IOS_APP V   08:42:05    2021-05-01
9   2021-05-01 08:42:05 158655  38982545    IOS_APP V   08:42:05    2021-05-01
10  2021-05-01 08:42:05 158655  38815059    IOS_APP V   08:42:05    2021-05-01
11  2021-05-01 08:42:05 158655  38939806    IOS_APP V   08:42:05    2021-05-01
12  2021-05-01 08:42:05 158655  38957174    IOS_APP V   08:42:05    2021-05-01
13  2021-05-01 08:42:05 158655  39002021    IOS_APP V   08:42:05    2021-05-01
14  2021-05-01 08:42:05 158655  38396095    IOS_APP V   08:42:05    2021-05-01
15  2021-05-01 08:42:05 158655  38969243    IOS_APP V   08:42:05    2021-05-01
16  2021-05-01 08:42:05 158655  38880479    IOS_APP V   08:42:05    2021-05-01
17  2021-05-01 08:42:05 158655  38973440    IOS_APP V   08:42:05    2021-05-01
18  2021-05-01 08:42:05 158655  38908077    IOS_APP V   08:42:05    2021-05-01
19  2021-05-01 08:42:05 158655  38899054    IOS_APP V   08:42:05    2021-05-01

Topic groupby sql pandas python

Category Data Science


This should be possible by first aggregating the data to get the number of records for each job identifier and kind of action and then pivoting the rows to the columns:

(
    df
    .groupby(["job_id", "kind"])
    .count()["resume_id"]
    .reset_index()
    .pivot(index="job_id", columns="kind")
)

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.