# Numpy Array Operations Cheat Sheet

## Creating Arrays

```python
import numpy as np
np.array([1, 2, 3])
np.zeros((3, 4))          # 3x4 array of zeros
np.ones((2, 2))
np.arange(0, 10, 2)       # 0, 2, 4, 6, 8
np.linspace(0, 1, 5)      # 5 evenly spaced values between 0 and 1
```

## Indexing & Slicing

```python
arr[0]           # first element
arr[-1]          # last element
arr[1:4]         # slice
arr[arr > 5]     # boolean indexing (elements greater than 5)
matrix[1, 2]     # row 1, column 2 (2D array)
```

## Array Math

```python
arr + 10          # add 10 to every element
arr * 2            # multiply every element by 2
arr1 + arr2        # element-wise addition (same shape)
np.sum(arr)
np.mean(arr)
np.max(arr)
np.sqrt(arr)
```

## Reshaping

```python
arr.reshape(2, 3)   # reshape to 2 rows, 3 columns
arr.flatten()        # convert to 1D
arr.T                # transpose
```

## Broadcasting

```python
# A smaller array is "stretched" to match a larger one automatically
matrix + np.array([1, 2, 3])   # adds [1,2,3] to every row
```

## Common Mistakes

- Array shape ကို print(arr.shape) ဖြင့် double-check မလုပ်ဘဲ operation run ကြိုးစားခြင်း (shape mismatch error)
- Python list ကို Numpy array လို့ ထင်ပြီး element-wise math operation (list + list = concatenation, ≠ addition) ကြိုးစားခြင်း
