Home > Net >  How to for each column value, grouped by another column values, return percentage ratio?
How to for each column value, grouped by another column values, return percentage ratio?

Time:09-07

It's a complex problem, I don't know how to formulate the question, just copy-paste the code below to see the sampled data frame (original has >million rows):

df = pd.DataFrame({'App ID': {0: 'com.hindise.hindisahitya',
  1: 'com.hindise.hindisahitya',
  2: 'com.hindise.hindisahitya',
  3: 'com.hindise.hindisahitya',
  4: 'com.finwizard.fisdom',
  5: 'com.finwizard.fisdom',
  6: 'com.finwizard.fisdom',
  7: 'com.finwizard.fisdom',
  8: 'com.finwizard.fisdom',
  9: 'com.finwizard.fisdom',
  10: 'com.finwizard.fisdom',
  11: 'com.finwizard.fisdom',
  12: 'com.hindise.hindisahitya',
  13: 'com.hindise.hindisahitya',
  14: 'com.hindise.hindisahitya',
  15: 'com.hindise.hindisahitya',
  16: 'org.altruist.BajajExperia',
  17: 'org.altruist.BajajExperia',
  18: 'org.altruist.BajajExperia',
  19: 'org.altruist.BajajExperia'},
 'Star': {0: 3,
  1: 5,
  2: 5,
  3: 4,
  4: 5,
  5: 1,
  6: 1,
  7: 1,
  8: 5,
  9: 1,
  10: 1,
  11: 1,
  12: 3,
  13: 5,
  14: 5,
  15: 4,
  16: 5,
  17: 1,
  18: 1,
  19: 1},
 'Text': {0: 'No thats okay ...I Found some network issue in my phone that is by your app is not working properly ...but now its working thanks for your Quick reaction !',
  1: 'its a great app evr for preparation for govt exams or very useful for the great knowledge! about our religious books and thoughts',
  2: "I just loved it ..I don't know if it helps in clarifying net exam or not but surely it is increasing my knowledge and because of this app I made myself somewhat busy            
  • Related