This tutorial is designed to guide you on how to create an array of **complex numbers** in Python. **Complex numbers** in Python consist of a **real** and an **imaginary part**. With the help of the NumPy library, we can instead create multi-dimensional arrays of complex numbers with ease.

### Step 1: Importing Necessary Library

In order to utilize the power of arrays, we need to use the **NumPy library**. Don’t worry if you haven’t used or heard of NumPy before, it is basically a library in Python used for working with arrays. The first step will be importing NumPy into our Python script. This can be done with the following code:

1 |
import numpy as np |

### Step 2: Define Your Complex Numbers

Next, let’s define our complex numbers. In Python, a **complex number** is defined using the “j” notation, not “i” as used in mathematics. For example,

1 2 |
complex_num1 = 3 + 4j complex_num2 = 2 - 5j |

### Step 3: Create an Array of Complex Numbers

The final step is to create our array by using the **numpy.array()** function and passing our complex numbers as elements into this function. This can be done as follows:

1 |
array_complex_numbers = np.array([complex_num1, complex_num2]) |

Now, you have successfully created an array of complex numbers. You can **print** this array to confirm:

1 |
print(array_complex_numbers) |

If everything has been followed correctly up to this point, your output should be:

[3+4j 2-5j]

## Full Python Code

Here’s the full Python code that includes all the steps mentioned above:

1 2 3 4 5 6 7 8 |
import numpy as np complex_num1 = 3 + 4j complex_num2 = 2 - 5j array_complex_numbers = np.array([complex_num1, complex_num2]) print(array_complex_numbers) |

## Conclusion

Congratulations! Now you have learned how to create an array of complex numbers in Python using the NumPy library. The concept of complex numbers and multi-dimensional arrays is a must-know for every aspiring data scientist or programmer aiming to work extensively with data in Python.

You can explore the **NumPy library** further to find out more about various other functionalities that it offers.