Hi, guys, I've been practicing my python skills mostly on pandas and I've been facing a problem. I have a data frame selected from an SQL table that looks like this
0 1 621.76M
1 2 329.51M
in other word,
[(1, '621.76M'), (2, '329.51M')]
I want to split the shares_float so that if it is 'B', multiply 1,000,000,000 and if it is 'M', multiply 1,000,000 and if it is neither or doesn't have the trailing character just convert and assign the number.
The outcome should be a float type
ticker_id shares_float float_value
0 1 621.76M 621760000.00
1 2 3.51B 3510000000.00
I am kind of a novice at pandas. Is there a way to do it in pandas? or should I convert data to list and do my manipulation in a loop and then convert it back to pandas DataFrame?