# P12.2 NumPy Arrays कसे बनवायचे: array, arange, zeros, linspace

Source: https://ravindrabagale.com/mr/datascience/py12-numpy-tutorial-for-beginners-arrays-math-and-filtering/p12-2-how-to-create-numpy-arrays-array-arange-zeros.html
Language: mr (Marathi with English technical terms)

हे का शिकायचं?

Data नेहमी list मधून येत नाही; कधी number ची रांग किंवा शून्यांचा array हवा असतो.

हे काय आहे?

np.array(list), np.arange(start, stop, step), np.zeros(n) आणि np.linspace(a, b, n). .shape आणि .dtype ने आकार आणि type कळतो.

कसं करायचं?

Step 1. योग्य function निवडा.
Step 2. shape आणि dtype तपासा.

उदाहरण A: बनवा आणि तपासा

```python
import numpy as np
rev = np.array([12.5, 14.0, 13.2, 15.8])
print(rev)
print(rev.shape, rev.dtype)
print(rev[0], rev[-1])
```

Output:

```text
[12.5 14.  13.2 15.8]
(4,) float64
12.5 15.8
```

याचा अर्थ: shape ने लांबी आणि dtype ने type कळला.

उदाहरण B: Ranges आणि zeros

```python
import numpy as np
days = np.arange(1, 8)
counts = np.zeros(7)
print(days)
print(counts)
```

Output:

```text
[1 2 3 4 5 6 7]
[0. 0. 0. 0. 0. 0. 0.]
```

याचा अर्थ: arange ने numbers ची रांग आणि zeros ने शून्यांचा array मिळाला.

रवींद्र बागले यांची tip

Array मधल्या सगळ्या values चा एकच dtype असतो. Numbers आणि text मिसळले तर सगळं text होतं — बनवल्यावर `.dtype` तपासा.
