I have a large list of data, but one column I am filtering by (sales) has some missing data. It seems that I am getting an error with the function I made to convert dollar abbreviations (110M to 110,000,000) when here are missing values in the list. The error I get is "TypeError: 'int' object is not subscriptable." So I am trying to replace all missing values in this column with 0 so that when I run the function, it will iterate through every value in the column and if I filter so that sales > certain value, it will just filter those rows out.
Here an example of this:
def num_conv(sales_list):
m = {'M': 6, 'B': 9}
return ([(float(i[:-1]) * 10 ** m[i[-1]]) for i in sales_list])
sales = ['100M', '100B', None, '200M']
sales = sales.replace(np.nan, 0)
sales = num_conv(sales)
print(sales)