Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version


class qiskit.opflow.expectations.PauliExpectation(group_paulis=True)

GitHub(opens in a new tab)

Bases: ExpectationBase

An Expectation converter for Pauli-basis observables by changing Pauli measurements to a diagonal ({Z, I}^n) basis and appending circuit post-rotations to the measured state function. Optionally groups the Paulis with the same post-rotations (those that commute with one another, or form Abelian groups) into single measurements to reduce circuit execution overhead.

Deprecated since version 0.24.0

The class qiskit.opflow.expectations.pauli_expectation.PauliExpectation is deprecated as of qiskit-terra 0.24.0. It will be removed no earlier than 3 months after the release date. For code migration guidelines, visit in a new tab).


group_paulis (bool(opens in a new tab)) – Whether to group the Pauli measurements into commuting sums, which all have the same diagonalizing circuit.




Compute the variance of the expectation estimator.


exp_op (OperatorBase) – The full expectation value Operator after sampling.


The variances or lists thereof (if exp_op contains ListOps) of the expectation value estimation.

Return type

list(opens in a new tab) | float(opens in a new tab) | ndarray(opens in a new tab)



Accepts an Operator and returns a new Operator with the Pauli measurements replaced by diagonal Pauli post-rotation based measurements so they can be evaluated by sampling and averaging.


operator (OperatorBase) – The operator to convert.


The converted operator.

Return type


Was this page helpful?
Report a bug or request content on GitHub.