I have a dataframe like below
textdata
id user_category operator circle
0 23 1 vodafone mumbai
1 45 2 airtel andhra
2 65 3 airtel chennai
3 23 6 vodafone mumbai
4 45 1 airtel gurgaon
5 65 3 airtel ongole
6 23 4 vodafone mumbai
7 45 1 airtel telangana
8 65 3 airtel chennai
In my data 1,2,4,6 in user category is transactional and 3 in user_category is promotional data.So i have divided that by using the following commands
transactional = textdata[textdata['user_category'].isin([1,2,4,6])]
promotional = textdata[textdata['user_category'].isin([1])]
so i got the output for transactional and promotional like below
transactional
id user_category operator circle
0 23 1 vodafone mumbai
1 45 2 airtel andhra
3 23 6 vodafone mumbai
4 45 1 airtel gurgaon
6 23 4 vodafone mumbai
7 45 1 airtel telangana
promotional
id user_category operator circle
2 65 3 airtel chennai
8 65 3 airtel chennai
5 65 3 airtel ongole
but what i am expecting is to order the index Expected output:
transactional
id user_category operator circle
0 23 1 vodafone mumbai
1 45 2 airtel andhra
2 23 6 vodafone mumbai
3 45 1 airtel gurgaon
4 23 4 vodafone mumbai
5 45 1 airtel telangana
promotional
id user_category operator circle
1 65 3 airtel chennai
2 65 3 airtel chennai
3 65 3 airtel ongole
this is how i tried for that
transactional.reset_index(inplace = True)
And this is how i got
transactional
index id user_category operator circle
0 0 23 1 vodafone mumbai
1 1 45 2 airtel andhra
2 3 23 6 vodafone mumbai
3 4 45 1 airtel gurgaon
4 6 23 4 vodafone mumbai
5 7 45 1 airtel telangana
But i am expecting in the following way
transactional
id user_category operator circle
0 23 1 vodafone mumbai
1 45 2 airtel andhra
2 23 6 vodafone mumbai
3 45 1 airtel gurgaon
4 23 4 vodafone mumbai
5 45 1 airtel telangana
Please help me how can i do this.
But don't suggest me like this way
del transactional['index']
Thanks in advance