DataBin
class qiskit.primitives.DataBin(*, shape=(), **data)
Bases: ShapedMixin
Namespace for storing data.
import numpy as np
from qiskit.primitives import DataBin, BitArray
data = DataBin(
alpha=BitArray.from_samples(["0010"]),
beta=np.array([1.2])
)
print("alpha data:", data.alpha)
print("beta data:", data.beta)
alpha data: BitArray(<shape=(), num_shots=1, num_bits=2>)
beta data: [1.2]
Parameters
- data – Name/value data to place in the data bin.
- shape (ShapeInput) – The leading shape common to all entries in the data bin. This defaults to the trivial leading shape of
()
that is compatible with all objects.
Raises
- ValueError – If a name overlaps with a method name on this class.
- ValueError – If some value is inconsistent with the provided shape.
Attributes
ndim
shape
size
Methods
items
keys
values
Was this page helpful?
Report a bug or request content on GitHub.