I have a list where most element are numbers in form of strings and a few normal strings that I got from a dataset.
Here's the first 50 items:
['-', '-', '-', '-', '-', '404000000', '110000000', '4926000', '15000000', '-', '-', '-', '-', '-', '14900000', '66100000', '15000000', '13000000', '20000000', '-', '20000000', '30000000', '-', '-', '-', '-', '278000000', '-', '17000000', '275000000', '121000000', '-', '12000000', '-', '29000000', '-', '267000000', '500000000', '50000000', '-', '356000000', '-', '-', '-', '20000000', '-', '-', '-', '-', '-']
I want to replace those '-' and 'undisclosed' with the number 0. I followed this answer on a stackoverflow question but that tutorial did not work and I even tried this but still didn't work.
for p in price:
if p != '-' and p != 'undisclosed':
p = int(p)
else:
p = 0