the ID in CSV is appearing like
[1]
[2]…
How to correct this
test=pd.read_csv(’/Users/parthsharma/Desktop/Data Science CB/Test/ID.csv’).values
with open(‘Submission.csv’,‘w’) as f:
for i in test:
joke=[]
url=“http://api.icndb.com/jokes/{}”.format(int(i))
response=requests.get(url)
result=""
joke=json.loads(response.content)[‘value’][‘joke’] #load the joke in json format and extract value and joke column
result+="{},".format(i)+joke+"\n"
#print(result)
f.write(result)
https://drive.google.com/file/d/1mUxvatfT8vQoY8iHg7Td6haRNpbGU-w2/view?usp=sharing