Let's say I have the following Python List:
['7831-0', nan, '3165-0', '7831-0', '7831-1']
I want to add the same prefix ('ADD_' to each element in the above list. I also want to remove the nan from my list. My desired output list is as follows:
list = ['ADD_7831-0', 'ADD_3165-0', 'ADD_7831-0', 'ADD_7831-1']
I tried the following code:
prefix_ADD = 'ADD_'
new_list = [prefix_ADD + x for x in list]
But I get the following error:
TypeError: must be str, not float