# Access results from an experiment without having to run the script again

I have ran an experiment in one of the IBM processors and the work has finished. However, I can not obtain the data as histograms or counts in the qiskit notebook because the experiment was concluded while I was logged off and therefore now I would need to run the full script again. That is, I would need to run the experiment again. My question is if there is some way to access the results in the notebook without this requirement. I know that the histograms are stored in the section "results" but I specifically want to work with them in the notebook. Thank you.

provider = IBMQ.load_account()


From this you can access a list of all your jobs with

provider.circuits.client.get_status_jobs()


Each job is recorded as a dictionary. One of the keys is 'id', which is the job id. To extract this for the first job on the list, for example, use

job_id = provider.circuits.client.get_status_jobs()[0]['id']


You can then use

job_info = provider.circuits.client.get_job(job_id)


To get a JSON which contains all the information about the job, including the results. The counts data for the first circuit in the job, for example, can be found at

job_info['qObjectResult']['results'][0]['data']['counts']


Though note that the strings will be hex strings rather than bit strings, and so will need conversion.

• Hi James, thank you for the answer. I followed your instructions and at the end I get some information about the execution of the job. However, I still don't know how to access the results from the notebook. When I introduce something like job.get_counts("some circuit") it tells me that "job" is not defined, so it seems that anyway I would have to execute the job again because for what I know this is the only way I can define it. – Henao Aug 29 '19 at 13:38
• @Henao I added a line on how to get counts info. – James Wootton Aug 29 '19 at 16:35
• Thanks James, I added the line but then it tells me that "job_info" is not defined. I changed it by job_id, since this is how the circuit was previously identified, and then it tells me that "string indices must be integers". I really don't understand the meaning or function of job_info and 'qObjectResult' in the command, although the other part of it is more intuitive. – Henao Sep 1 '19 at 8:03
• Looks like I forgot to define job_info. See my new snippets – James Wootton Sep 2 '19 at 11:05

You can get a previous result by grabbing the corresponding job from the backend you sent it to:

from qiskit import *

$$$$
`