# Output a Cirq gate as a Numpy array?

How do I output a Cirq gate as a Numpy array? For example, I would like to print a Pauli X gate cirq.X as

numpy.array([[0,1],[1,0]])


Thank you.

This can be done by calling cirq.unitary.
>>> import cirq

• @CraigGidney Compared to Qiskit, I feel that Cirq's tutorial and documents are too short. (Though, I just realized cirq.unitary() is mentioned in the tutorial page, so that's my bad.) Also, details of the API are sometimes located only in their source code, so I found it a bit difficult to learn Cirq. I think extensive tutorial videos on Youtube would be very helpful. – user3886914 Oct 15 '20 at 4:57