I have data of NHPM_IDs repeating in dataframe as in sample image as follow
need to create count NHPM id column next to NHPM_id as follows
This task is to find out how many times each NHPM_ID is appearing in column( for ex an NHPMID "ABC" is appearing 3 times in row no 12, 500, 1221 consecutively, I need column saying that
- ABC in row no 12 appears 3 times in column, when counted rows from 12 to last Row of data
- ABC in row no 500 appears 2 times in column, when counted rows from 500 to last Row of data
- ABC in row no 1221 appears 1 time in column, when counted rows from 1221 to last Row of data
this task is to ease the PIVOT table for count of unique NHPM_ids with other variables
I have 5 to 6 lacs rows need to perform this task every day, help will be appreciated