I have the table such that:
no Order materials status
1 1000 100 available
2 1000 200 not available
3 1001 500 Feb-20
4 1002 400 available
5 1002 300 not available
6 1002 600 available
7 1002 900 available
8 1003 700 available
9 1003 800 available
And I'd like to have columns that shows:
- Total number of materials per Order
- Total number of materials with their status per Order
I was able to get the total number of materials per Order:
ds.groupby('Order').count()
ds['Total Materials'] = ds.groupby('Order')['Order'].transform('count')
But not sure how to add a new columns based on conditions where status equals to each status, So that it will look like this:
no Order materials status Total Materials available not available Feb-20
1 1000 100 available 2 1 1 0
2 1000 200 not available 2 1 1 0
3 1001 500 Feb-20 1 0 0 1
4 1002 400 available 4 3 1 0
5 1002 300 not available 4 3 1 0
6 1002 600 available 4 3 1 0
7 1002 900 available 4 3 1 0
8 1003 700 available 2 2 0 0
9 1003 800 available 2 2 0 0
Basically trying to figure out how to get the rest of the columns. Would appreciate your help!