# skspatial.objects.Vector¶

class skspatial.objects.Vector(array: Union[numpy.ndarray, Sequence])[source]

A vector implemented as a 1D array.

The array is a subclass of `numpy.ndarray`.

Parameters
arrayarray_like

Input array.

Raises
ValueError

If the array is empty, the values are not finite, or the dimension is not one.

Examples

```>>> from skspatial.objects import Vector
```
```>>> vector = Vector([1, 2, 3])
```
```>>> vector.dimension
3
```

The object inherits methods from `numpy.ndarray`.

```>>> vector.mean()
array(2.)
```
```>>> Vector([])
Traceback (most recent call last):
...
ValueError: The array must not be empty.
```
```>>> import numpy as np
```
```>>> Vector([1, 2, np.nan])
Traceback (most recent call last):
...
ValueError: The values must all be finite.
```
```>>> Vector([[1, 2], [3, 4]])
Traceback (most recent call last):
...
ValueError: The array must be 1D.
```
Attributes
dimensionint

Dimension of the vector.

## Methods¶

 `angle_between`(other) Return the angle in radians between the vector and another. `angle_signed`(other) Return the signed angle in radians between the vector and another. `cosine_similarity`(other) Return the cosine similarity of the vector with another. `cross`(other) Compute the cross product with another vector. `different_direction`(**kwargs) Return a simple vector that is in a different direction. `from_points`(point_a, point_b) Instantiate a vector from point A to point B. `is_parallel`(other, **kwargs) Check if the vector is parallel to another. `is_perpendicular`(other, **kwargs) Check if the vector is perpendicular to another. `is_zero`(**kwargs) Check if the vector is the zero vector. `norm`(**kwargs) Return the norm of the vector. `plot_2d`(ax_2d[, point, scalar]) Plot a 2D vector. `plot_3d`(ax_3d[, point, scalar]) Plot a 3D vector. `project_vector`(other) Project an other vector onto the vector. `scalar_projection`(other) Return the scalar projection of an other vector onto the vector. `side_vector`(other) Find the side of the vector where another vector is directed. Return the unit vector in the same direction as the vector.