---
title: Result (v2.0)
description: API reference for qiskit.result.Result in qiskit v2.0
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/2.0/qiskit.result.Result
---

# Result

*class* `qiskit.result.Result(*, backend_name=None, backend_version=None, job_id=None, success=None, results=None, date=None, status=None, header=None, **kwargs)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.0/qiskit/result/result.py#L26-L385)

Bases: [`object`](https://docs.python.org/3/library/functions.html#object)

Model for Results.

### backend\_name

backend name.

**Type**

[str](https://docs.python.org/3/library/stdtypes.html#str)

### backend\_version

backend version, in the form X.Y.Z.

**Type**

[str](https://docs.python.org/3/library/stdtypes.html#str)

### job\_id

unique execution id from the backend.

**Type**

[str](https://docs.python.org/3/library/stdtypes.html#str)

### success

True if complete input executed correctly. (Implies each experiment success)

**Type**

[bool](https://docs.python.org/3/library/functions.html#bool)

### results

corresponding results for array of experiments of the input

**Type**

[list](https://docs.python.org/3/library/stdtypes.html#list)\[ExperimentResult]

### date

optional date field

**Type**

[str](https://docs.python.org/3/library/stdtypes.html#str)

### status

optional status field

**Type**

[str](https://docs.python.org/3/library/stdtypes.html#str)

### header

an optional free form dictionary header

**Type**

[dict](https://docs.python.org/3/library/stdtypes.html#dict)

## Methods

### data

`data(experiment=None)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.0/qiskit/result/result.py#L126-L176)

Get the raw data for an experiment.

Note this data will be a single classical and quantum register and in a format required by the results schema. We recommend that most users use the get\_xxx method, and the data will be post-processed for the data type.

**Parameters**

**experiment** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)  *or*[*QuantumCircuit*](/docs/api/qiskit/2.0/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")  *or*[*int*](https://docs.python.org/3/library/functions.html#int) *or None*) – the index of the experiment. Several types are accepted for convenience:: \* str: the name of the experiment. \* QuantumCircuit: the name of the circuit instance will be used. \* int: the position of the experiment. \* None: if there is only one experiment, returns it.

**Returns**

A dictionary of results data for an experiment. The data depends on the backend it ran on and the settings of meas\_level, meas\_return and memory.

OpenQASM backends return a dictionary of dictionary with the key ‘counts’ and with the counts, with the second dictionary keys containing a string in hex format (`0x123`) and values equal to the number of times this outcome was measured.

Statevector backends return a dictionary with key ‘statevector’ and values being a list\[list\[complex components]] list of 2^num\_qubits complex amplitudes. Where each complex number is represented as a 2 entry list for each component. For example, a list of \[0.5+1j, 0-1j] would be represented as \[\[0.5, 1], \[0, -1]].

Unitary backends return a dictionary with key ‘unitary’ and values being a list\[list\[list\[complex components]]] list of 2^num\_qubits x 2^num\_qubits complex amplitudes in a two entry list for each component. For example if the amplitude is \[\[0.5+0j, 0-1j], …] the value returned will be \[\[\[0.5, 0], \[0, -1]], …].

The simulator backends also have an optional key ‘snapshots’ which returns a dict of snapshots specified by the simulator backend. The value is of the form dict\[slot: dict\[str: array]] where the keys are the requested snapshot slots, and the values are a dictionary of the snapshots.

**Return type**

[dict](https://docs.python.org/3/library/stdtypes.html#dict)

**Raises**

[**QiskitError**](/docs/api/qiskit/2.0/exceptions#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") – if data for the experiment could not be retrieved.

### from\_dict

*classmethod* `from_dict(data)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.0/qiskit/result/result.py#L109-L124)

Create a new ExperimentResultData object from a dictionary.

**Parameters**

**data** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict)) – A dictionary representing the Result to create. It will be in the same format as output by [`to_dict()`](#qiskit.result.Result.to_dict "qiskit.result.Result.to_dict").

**Returns**

The `Result` object from the input dictionary.

**Return type**

[Result](#qiskit.result.Result "qiskit.result.Result")

### get\_counts

`get_counts(experiment=None)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.0/qiskit/result/result.py#L232-L282)

Get the histogram data of an experiment.

**Parameters**

**experiment** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)  *or*[*QuantumCircuit*](/docs/api/qiskit/2.0/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")  *or*[*int*](https://docs.python.org/3/library/functions.html#int) *or None*) – the index of the experiment, as specified by `data([experiment])`.

**Returns**

a dictionary or a list of dictionaries. A dictionary has the counts for each qubit with the keys containing a string in binary format and separated according to the registers in circuit (e.g. `0100 1110`). The string is little-endian (cr\[0] on the right hand side).

**Return type**

[dict](https://docs.python.org/3/library/stdtypes.html#dict)\[[str](https://docs.python.org/3/library/stdtypes.html#str), [int](https://docs.python.org/3/library/functions.html#int)] or [list](https://docs.python.org/3/library/stdtypes.html#list)\[[dict](https://docs.python.org/3/library/stdtypes.html#dict)\[[str](https://docs.python.org/3/library/stdtypes.html#str), [int](https://docs.python.org/3/library/functions.html#int)]]

**Raises**

[**QiskitError**](/docs/api/qiskit/2.0/exceptions#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") – if there are no counts for the experiment.

### get\_memory

`get_memory(experiment=None)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.0/qiskit/result/result.py#L178-L230)

Get the sequence of memory states (readouts) for each shot The data from the experiment is a list of format \[‘00000’, ‘01000’, ‘10100’, ‘10100’, ‘11101’, ‘11100’, ‘00101’, …, ‘01010’]

**Parameters**

**experiment** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)  *or*[*QuantumCircuit*](/docs/api/qiskit/2.0/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")  *or*[*int*](https://docs.python.org/3/library/functions.html#int) *or None*) – the index of the experiment, as specified by `data()`.

**Returns**

Either the list of each outcome, formatted according to registers in circuit or a complex numpy np.ndarray with shape:

> | meas\_level | meas\_return | shape                                                 |
> | ----------- | ------------ | ----------------------------------------------------- |
> | 0           | single       | np.ndarray\[shots, memory\_slots, memory\_slot\_size] |
> | 0           | avg          | np.ndarray\[memory\_slots, memory\_slot\_size]        |
> | 1           | single       | np.ndarray\[shots, memory\_slots]                     |
> | 1           | avg          | np.ndarray\[memory\_slots]                            |
> | 2           | memory=True  | list                                                  |

**Return type**

List\[[str](https://docs.python.org/3/library/stdtypes.html#str)] or np.ndarray

**Raises**

[**QiskitError**](/docs/api/qiskit/2.0/exceptions#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") – if there is no memory data for the circuit.

### get\_statevector

`get_statevector(experiment=None, decimals=None)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.0/qiskit/result/result.py#L284-L304)

Get the final statevector of an experiment.

**Parameters**

- **experiment** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)  *or*[*QuantumCircuit*](/docs/api/qiskit/2.0/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")  *or*[*int*](https://docs.python.org/3/library/functions.html#int) *or None*) – the index of the experiment, as specified by `data()`.
- **decimals** ([*int*](https://docs.python.org/3/library/functions.html#int)) – the number of decimals in the statevector. If None, does not round.

**Returns**

list of 2^num\_qubits complex amplitudes.

**Return type**

[list](https://docs.python.org/3/library/stdtypes.html#list)\[[complex](https://docs.python.org/3/library/functions.html#complex)]

**Raises**

[**QiskitError**](/docs/api/qiskit/2.0/exceptions#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") – if there is no statevector for the experiment.

### get\_unitary

`get_unitary(experiment=None, decimals=None)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.0/qiskit/result/result.py#L306-L325)

Get the final unitary of an experiment.

**Parameters**

- **experiment** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)  *or*[*QuantumCircuit*](/docs/api/qiskit/2.0/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")  *or*[*int*](https://docs.python.org/3/library/functions.html#int) *or None*) – the index of the experiment, as specified by `data()`.
- **decimals** ([*int*](https://docs.python.org/3/library/functions.html#int)) – the number of decimals in the unitary. If None, does not round.

**Returns**

**list of 2^num\_qubits x 2^num\_qubits complex**

amplitudes.

**Return type**

[list](https://docs.python.org/3/library/stdtypes.html#list)\[[list](https://docs.python.org/3/library/stdtypes.html#list)\[[complex](https://docs.python.org/3/library/functions.html#complex)]]

**Raises**

[**QiskitError**](/docs/api/qiskit/2.0/exceptions#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") – if there is no unitary for the experiment.

### to\_dict

`to_dict()`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.0/qiskit/result/result.py#L84-L101)

Return a dictionary format representation of the Result

**Returns**

The dictionary form of the Result

**Return type**

[dict](https://docs.python.org/3/library/stdtypes.html#dict)
