I started not as a developer or an engineer but as a “solution finder.” I needed to resolve an issue for a client, and Python was the code of choice. That’s how my code journey into Python began. I started learning about libraries, and my knowledge grew from there. Usually, there was an example of how to use the library and the solution. I would review the code sample and solution, then modify it to work for what I needed. However, I need to refresh whenever I step away from this type of work. Sometimes the career journey takes a detour, but that doesn’t mean you can’t continue to work and build in your area of interest.

If you want to refresh your Python skills or brush up on certain concepts, this blog post is here to help. Let’s walk you through a code sample that utilizes a famous library and demonstrates how to work with a data array. So, let’s dive in and start refreshing those Python skills!

Code Sample: Using NumPy to Manipulate a Data Array

For this example, we’ll use the NumPy library, which is widely used for numerical computing in Python. NumPy provides powerful tools for working with arrays, making it an essential data manipulation and analysis library.

This same example can be used with Azure Data Studio, my tool of choice for my coding, with the advantage of connecting directly to the SQL database in Azure, but I will save that for another blog post.

Another of my favorites is Windows Subsystem for Linux; this example would apply.

Let’s get started by installing NumPy using pip:

pip install numpy

Once installed, we can import NumPy into our Python script:

import numpy as np

Now, let’s create a simple data array and perform some operations on it:

# Create a 1-dimensional array
data = np.array([1, 2, 3, 4, 5])

# Print the array
print("Original array:", data)

# Calculate the sum of all elements in the array
sum_result = np.sum(data)
print("Sum of array elements:", sum_result)

# Calculate the average of the elements in the array
average_result = np.average(data)
print("Average of array elements:", average_result)

# Find the maximum value in the array
max_result = np.max(data)
print("Maximum value in the array:", max_result)

# Find the minimum value in the array
min_result = np.min(data)
print("Minimum value in the array:", min_result)

In this code sample, we first create a 1-dimensional array called “data” using the NumPy array() function. We then demonstrate several operations on this array:

  1. Printing the original array using the print() function.
  2. Calculating the sum of all elements in the array using np.sum().
  3. Calculating the average of the elements in the array using np.average().
  4. Finding the maximum value in the array using np.max().
  5. Finding the minimum value in the array using np.min().

By running this code, you’ll see the results of these operations on the data array.


Refreshing your Python skills is made easier with hands-on examples. In this blog post, we explored a code sample that utilized the powerful NumPy library for working with data arrays. By installing NumPy, importing it into your script, and following the walk-through, you learned how to perform various operations on an array, such as calculating the sum, average, maximum, and minimum values. Join me on my journey deeper into the world of data manipulation and analysis in Python.