Hi guys,
Suppose to have a dataset:
ID Class Place
1 0 1
2 0 1
3 0 1
4 1 2
5 2 2
6 2 2
..... ..... .....
Then, you have another dataset of which you will take only the total number of rows, for example 10.
Now you want to divide the number of IDs in the first dataset by the total number of IDs in the second dataset, i.e., 10 but you want to do this by "Class" and "Place". How, this, can be achieved? In other words the desired output would be:
Place |
Class |
Count |
Ratio |
1 |
0 |
3 |
0.3 |
1 |
1 |
0 |
0 |
1 |
2 |
0 |
0 |
2 |
0 |
0 |
0 |
2 |
1 |
1 |
0.1 |
2 |
2 |
2 |
0.2 |
As you can see (as an example), for place =1, there are IDs only in Class 0 and they are 3 in total. So 3/10 = 0.3. These are example numbers of the real situation. Totally I have 10 "Classes", 1 "Place" and 19.398 rows in the first dataset and 76.984 rows in the second dataset.
Thank you in advance