numpy.binary_repr(num, width=None)
Examples from the documentation link above:
>>> np.binary_repr(3)'11'>>> np.binary_repr(-3)'-11'>>> np.binary_repr(3, width=4)'0011'
The two’s complement is returned when the input number is negative and width is specified:
>>> np.binary_repr(-3, width=3)'101'>>> np.binary_repr(-3, width=5)'11101'