Suppose I have the following DataFrame:
d = {'col1': [1000, 2, 3, 2400000]}
df = pd.DataFrame(data=d)
which results in
col1
1000
2
3
2400000
Suppose I would like to have this DataFrame formatting in thousands or millions, depending on the current value, how would I do this? Say I would like the result to be
col1
1K
2
3
2.4M
I know how to do it when I'd like the whole column to be formatting into millions or thousands, but not when it comes to separate values.