What are Numpy Scalars and Array Scalars

  arrays, numpy, numpy-ndarray, python, scalar

I am trying to learn NumPy basic concepts but unable to wrap my head around few things. I am following this NumPy documentation

Scalars
Python defines only one type of a particular data class (there is only one integer type, one floating-point type, etc.). This can be convenient in applications that don’t need to be concerned with all the ways data can be represented in a computer. For scientific computing, however, more control is often needed.
Here Scalars means single value?

In NumPy, there are 24 new fundamental Python types to describe different types of scalars. These type descriptors are mostly based on the types available in the C language that CPython is written in, with several additional types compatible with Python’s types. What python type means here? although its saying its based on C lang types.

Array scalars have the same attributes and methods as ndarrays. This allows one to treat items of an array partly on the same footing as arrays, smoothing out rough edges that result when mixing scalar and array operations. Absolutely not getting what Array scalar is? found this while searching but still confusing

Interestingly, the array scalars can have some array-like attributes. The only missing attribute is ctype.

If array scalars have same attributes as ndarrays? so which one to use?

Source: Python Questions

LEAVE A COMMENT