Category: Daily Data Science Puzzle

Python Numpy 101: How to Calculate the Weighted Average of a Numpy Array Along an Axis?

What is the output of this puzzle? *Beginner Level* (solution below) Numpy is a popular Python library for data science focusing on arrays, vectors, and matrices. This puzzle introduces the average function from the numpy library. When applied to a 1D numpy array, this function returns the average of the array values. When applied to…

Read MoreComment

Python Numpy 101: How to Calculate the Simple Average of a Numpy Array?

What is the output of this puzzle? *Beginner Level* (solution below) Numpy is a popular Python library for data science focusing on arrays, vectors, and matrices. This puzzle introduces the average function from the numpy library. When applied to a 1D numpy array, this function returns the average of the array values. When applied to…

Read MoreComment

Python Numpy 101: How to Index Elements in Numpy Arrays?

Daily Data Science Puzzle What is the output of this puzzle? *Beginner Level* (solution below) Numpy is a popular Python library for data science for array, vector, and matrix computations. This puzzle introduces basic indexing of elements in numpy arrays. The puzzle analysis data from the real-time air quality index (AQI) for the three cities…

Read MoreComment

How to Calculate the Standard Deviation of a Numpy Array?

Daily Data Science Puzzle What is the output of this puzzle? *Intermediate Level* (solution below) Numpy is a popular Python library for data science for array, vector, and matrix computations. This puzzle introduces the standard deviation function of the numpy library. In the puzzle, we have four temperature values as measured by a temperature sensor….

Read MoreComment

How to Calculate the Column Standard Deviation of a 2D Array in Numpy?

Daily Data Science Puzzle What is the output of this puzzle? *Advanced Level* (solution below) Numpy is a popular Python library for data science focusing on arrays, vectors, and matrices. This puzzle introduces the standard deviation function of the numpy library. When applied to a 1D numpy array, this function returns its standard deviation. When…

Read MoreComment

Python Numpy 101: How to Calculate the Row Variance of a Numpy 2D Array?

Daily Data Science Puzzle What is the output of this puzzle? *Advanced Level* (solution below) Numpy is a popular Python library for data science focusing on arrays, vectors, and matrices. This puzzle introduces a new feature of the numpy library: the variance function. When applied to a 1D numpy array, this function returns the variance…

Read MoreComment

A Case for Puzzle-based Learning Python

Overcome the Knowledge Gap The great teacher Sokrates delivered complex knowledge by asking a sequence of questions. Each question was building on answers to previous questions provided by the student. This more than 2400 year old teaching technique is still in wide-spread use today. A good teacher opens a gap between their’s and the learner’s…

Read MoreComment

Python Numpy 101: How to Calculate Variance of Numpy Arrays?

Daily Data Science Puzzle What is the output of this puzzle? *Intermediate Level* (solution below) Numpy is a popular Python library for data science focusing on arrays, vectors, and matrices. This puzzle introduces a new feature of the numpy library: the variance function. When applied to a 1D numpy array, this function returns the variance…

Read MoreComment

How to index 1D numpy arrays?

Daily Data Science Puzzle What is the output of this puzzle? *Intermediate Level* Numpy is a popular Python library for data science focusing on arrays, vectors, and matrices. This puzzle demonstrates indexing in numpy arrays. You most likely know indexing for Python lists or strings. Indexing for numpy works in a similar way. There are…

Read MoreComment

Take a Guess: What is the Meaning of the Numpy *-Operator, Matrix Multiplication or Element-wise Multiplication?

Daily Data Science Puzzle What is the output of this puzzle? *Advanced Level* Numpy is a popular Python library for data science. Numpy’s focus is computations on arrays, vectors, and matrices. If you work with data, you cannot avoid numpy. So learn it now and learn it well. We consider salary data of four jobs:…

Read MoreComment