numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
base_repr(number, base=2, padding=0)

Parameters

number : int

The value to convert. Positive and negative values are handled.

base : int, optional

Convert number to the :None:None:`base` number system. The valid range is 2-36, the default value is 2.

padding : int, optional

Number of zeros padded on the left. Default is 0 (no padding).

Returns

out : str

String representation of number in :None:None:`base` system.

Return a string representation of a number in the given base system.

See Also

binary_repr

Faster version of :None:None:`base_repr` for base 2.

Examples

>>> np.base_repr(5)
'101'
>>> np.base_repr(6, 5)
'11'
>>> np.base_repr(7, base=5, padding=3)
'00012'
>>> np.base_repr(10, base=16)
'A'
>>> np.base_repr(32, base=16)
'20'
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.binary_repr

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/core/numeric.py#2055
type: <class 'function'>
Commit: