diff --git a/contrib/numpy/datatypes.md b/contrib/numpy/datatypes.md new file mode 100644 index 0000000..fb9df47 --- /dev/null +++ b/contrib/numpy/datatypes.md @@ -0,0 +1,267 @@ +# Numpy Data Types +In NumPy, data types play a crcial role in representing and manipulating numerical data. + +Numpy supports the following data types: + +- `i` - integer +- `b` - boolean +- `u` - unsigned integer +- `f` - float +- `c` - complex float +- `m` - timedelta +- `M` - datetime +- `O` - object +- `S` - string +- `U` - unicode string + + +_Referred from: W3schools_ + +## dtype() Function +The `dtype()` function returns the type of the NumPy array object. + +Example 1 +``` python + import numpy as np + + arr = np.array([1, 2, 3, 4]) + + print(arr.dtype) + + # Output: int64 +``` + +Example 2 +``` python + import numpy as np + + arr = np.array(['apple', 'banana', 'cherry']) + + print(arr.dtype) + + # Output: