I have got a dataframe using instagramy. The dataframe consists of columns like Usernames, Followers, Following, Posts.
The dataframe looks like this
Usernames Followers Following Posts
0 A 1225002 1675 5647
1 B 11565253 998 12806
2 C 433688 895 994
3 D 7600455 31 15295
4 E 6706 33 478
5 F 1425 162 12
. . . . .
. . . . .
n n n n n
What I want to do is simply convert the values of followers from 1225002
to 1.2M
11565253
to 11.5M
So that the final dataframe will look like this
Usernames Followers Following Posts
0 A 1.2M 1675 5647
1 B 11.5M 998 12806
2 C 433K 895 994
3 D 7.6M 31 15295
4 E 6706 33 478
5 F 1425 162 12
. . . . .
. . . . .
n n n n n
I have tried to use numpy and pandas for converting the absolute numbers to a numerical string like these but I do not know the correct way of doing that. How can I do it? Please help!