why am i getting only 46% accuracy.I replaced all " with " .What might be wrong then?
I don’t think you need to anything apart from just fetching the joke and making a csv.
Would you mind sharing your code on cb.lk/ide so that i can check where you r going wrong
print(m) #574 list elements
li=[int(xxx) for xxx in input("enter the id u wanna search- ").split()]
with open(filename,‘w’,encoding=‘UTF-8’)as f:
HS=','.join(first_line) HS+='\n' f.write(HS)\ for i in range(574): if(m[i]['id'] in li): rs="" h=m[i]['id'] g=m[i]['joke'] lii=[str(h),g] rs=','.join(lii) rs+='\n' f.write(rs)
look the first row of csv file you have generated. It has 3 columns. because the joke had comma in itself, and while converting to csv you have separated the string with , so it becomes a new column.
something like this :
1,Chuck Norris uses ribbed condoms inside out, so he gets the pleasure.
Instead i would recommend you to make a dataframe and use .to_csv() to convert into csv. It is much more cleaner than this way
still cant figure cant.can u please do the required changes in the code above
Code is much cleaner now, If you don’t understand any line of code do let me know.
I hope this will help.
what Test/ID.csv is being read?
How would you know which joke to submit out of 574.
So, we consider the x_test file, which is already provided to you. It means you need to get the jokes for only these number of ids that are mentioned in the ID.csv file
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen