![enter image description here][1]
To create an Index for the ‘IMEI & IMSI’ pair as follows:
- IMEI index (named A): a number is assigned for each IMEI in sequential order, starting with the integer number 1.
- IMSI index (named as B): a number is assigned for each IMSI, in the sense that: if an IMEI appears more than once, the paired IMSIs will be assigned in sequential order, e.g.: 1, 2, 3...][2]
This is what I am trying
import pandas as pd
import numpy as np
df1 = pd.readcsv('file.csv')
df1 = df1[['Imei','Imsi']]
df1 = df1.groupby(['Imei']).count()
df1 = df1.rename(columns = {'Imsi': 'Occurences'})
df1 = df1.sort_values(by=['Occurences'],ascending= False)
df1 = df1.reset_index()
I am able to count occurrences but how can I print them in order starting from 1 like shown in the image