When working with data in Python, there are several ways to perform operations on data, including using loops, apply, and vectorized operations provided by Pandas. Loops: Using a loop, such as a for loop, to iterate over each element in a dataset, is generally the slowest method for performing operations…