...

Full Bio

Google Go Language Future, Programming Language Programmer Will Get Best Paid Jobs

47 days ago

New Coder Tool Promises to Turbo-Charge Coding In Major Programming Language

48 days ago

Why Many Companies Plan To Double Artificial Intelligence Projects In The Next Year

48 days ago

Why 75% SMBs Are Not Worried About Artifical Intelligence Killing Their Jobs

48 days ago

Interview Study Guide for Data Science To Get Job Quickly

51 days ago

Highest Paying Programming Language, Skills: Here Are The Top Earners

635220 views

Top 10 Best Countries for Software Engineers to Work & High in-Demand Programming Languages

458673 views

Which Programming Languages in Demand & Earn The Highest Salaries?

441507 views

50+ Data Structure, Algorithms & Programming Languages Interview Questions for Programmers

260364 views

100+ Data Structure, Algorithms & Programming Language Interview Questions Answers for Programmers - Part 1

222792 views

### Why We Need to Forget 'For-Loop' for Data Science Code And Embrace Vectorization

- ndarray, a fast and space-efficient multidimensional array providing vectorized arithmetic operations and sophisticated broadcasting capabilities
- Standard mathematical functions for fast operations on entire arrays of data without having to write loops

You will often come across this assertion in the data science, machine learning, and Python community that Numpy is much faster due to its vectorized implementation and due to the fact that many of its core routines are written in C (based on CPython framework).

- Create a list of a moderately large number of floating point numbers, preferably drawn from a continuous statistical distribution like a Gaussian or Uniform random. I chose 1 million for the demo.
- Create a ndarray object out of that list i.e. vectorize.
- Write short code blocks to iterate over the list and use a mathematical operation on the list say taking logarithm of base 10. Use for-loop, map-function, and list-comprehension. Each time use time.time() function to determine how much time it takes in total to process the 1 million records.

- Do the same operation using Numpy's built-in mathematical method (np.log10) over the ndarray object. Time it.

- Store the execution times in a list and plot a bar chart showing the comparative difference.