i want help to finish muy guided project.
when i use “display_table(free_IOS , -5)” to display the frequantly table in Apple Store.
But, it shows me the the data in Google play store.
,thanks
could you please provide the code for the display_table()
function as well as the assignment of your free_IOS
variable?
thx
** the code for the display_table()
function:**
def freq_table(data_clean, index):
table={}
total=0
for row in free_android:
total+=1
value = row[index]
if value in table:
table[value]+=1
else:
table[value]=1
table_precentages={}
for key in table:
precentage=(table[key]/total)*100
table_precentages[key]=precentage
return table_precentages
def display_table(data_clean, index):
table = freq_table(data_clean, index)
display = [ ]
for key in table:
key_value=(table[key],key)
display.append(key_value)
table_stored= sorted(display,reverse = True)
for row in table_stored:
print(row[1], ':', row[0])
free_IOS
variable:
free_android=[ ]
free_IOS=[ ]
for row in android_english:
price=row[7]
if price ==‘0’:
free_android.append(row)
for row in IOS_english:
price=row[4]
if price == ‘0.0’:
free_IOS.append(row)
Hi @nagi6752. The code is a little hard to read because it didn’t format properly, but it seems like the problem might be in your freq_table()
function. Inside the function you have a loop that goes through all the rows in the android set. This means that no matter which dataset you pass into the function, it’s only going to build a frequency table based on the android set. You’ll want to change the free_android
part of for row in free_android:
so that it uses the variable data_clean
.
I hope this is helpful. Let us know if you’re still having trouble.
you are awesome…