Screen Link:
My Code:
free_eng_apple = []
free_eng_google = []
for row in eng_apple:
price = float(row[4])
if price == 0.0:
free_eng_apple.append(row)
print(free_eng_apple[:5])
for row in eng_google:
price = float(row[7])
if price == 0.0:
free_eng_google.append(row)
print(free_eng_google[:5])
What I expected to happen:
isolating free apps
What actually happened:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-12-d7e005ad9fad> in <module>
16
17 for row in eng_google:
---> 18 price = float(row[7])
19 if price == 0.0:
20 free_eng_google.append(row)
ValueError: could not convert string to float: '$4.99'
I guess you can simply put like below, without changing the price column to float.:
android_final = []
ios_final = []
for app in android_english:
price = app[7]
if price == '0':
android_final.append(app)
for app in ios_english:
price = app[4]
if price == '0.0':
ios_final.append(app)
print(len(android_final))
print(len(ios_final))
however, there could still be an error if there’s a value like $0.0, and this will be not regarded as a free app since this is not ‘0.0’. is there anyway to simply delete $ or € or any other currency signs?
Thank you!