I have a dataframe
0 1 2 3 Marketcap
0 1.707280 0.666952 0.638515 -0.061126 2.291747 1.71B
1 -1.017134 1.353627 0.618433 0.008279 0.148128 1.82B
2 -0.774057 -0.165566 -0.083345 0.741598 -0.139851 1.1M
3 -0.630724 0.250737 1.308556 -1.040799 1.064456 30.92M
4 2.029370 0.899612 0.261146 1.474148 -1.663970 476.74k
5 2.029370 0.899612 0.261146 1.474148 -1.663970 -1
Is there some sort of custom filter method, that would let Python know B > M > K?
Say I want to filter, df[df.Marketcap > 35.00M]
, is there a clever or clean way to do this?
Having the M or B makes the value very readable and easy to differentiate.
Thank you.
EDIT: Reopened the thread as Max U's answer while excellent seems to produce a pandas bug, which we opened an issue on Github.