Python 3

A Recursive Pathfinder Algorithm in Python

A simple and effective way to grow your computer science skills is to master the basics. Knowing the basics sets apart the great coders from the merely intermediate ones. One such basic area in computer science is graph theory, a specific subproblem of which—the pathfinder algorithm—we’ll address in this tutorial. So first things first: What …

A Recursive Pathfinder Algorithm in Python Read More »

Numpy Weighted Average np.average(array, axis=0, weights=[0.1,0.1,0.8])

How to Calculate the Weighted Average of a Numpy Array in Python?

Problem Formulation: How to calculate the weighted average of the elements in a NumPy array? Definition weighted average: Each array element has an associated weight. The weighted average is the sum of all array elements, properly weighted, divided by the sum of all weights. Here’s the problem exemplified: Quick solution: Before we discuss the solution …

How to Calculate the Weighted Average of a Numpy Array in Python? Read More »

How to Calculate the Average of a NumPy 2D Array?

NumPy is a popular Python library for data science focusing on arrays, vectors, and matrices. This article introduces the np.average() function from the NumPy library. When applied to a 1D array, this function returns the average of the array values. When applied to a 2D array, NumPy simply flattens the array. The result is the …

How to Calculate the Average of a NumPy 2D Array? Read More »

How to Index Elements in NumPy Arrays?

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. Problem Formulation: How to index elements in NumPy arrays? Indexing 1D Arrays with Positive Indices The most simple use of indexing is with the square bracket notation and positive integers: …

How to Index Elements in NumPy Arrays? Read More »

A Simple Recommendation System Using Pandas corrwith() Method

What is a Recommendation System? If you use Netflix or Amazon you have already seen the results of recommendation systems – movie or item recommendations that fit your taste or needs. So, at its core a recommendation system is a statistical algorithm that computes similarities based on previous choices or features and recommends users which …

A Simple Recommendation System Using Pandas corrwith() Method Read More »

Pyhton Freelancer

How to Become a Python Freelancer—and Earn $1,000 on the Side? [A Step-by-Step Tutorial]

Do you want to earn money as a Python freelancer? But you just start out learning Python? This article leads you step-by-step through the adventure of becoming a Python freelancer. Learn about the exact steps you need to do to become a Python freelancer – starting out as a Python newbie. Without losing any time, let’s dive into the 7 steps of becoming a Python freelancer.

Python Dictionary – The Ultimate Guide

Python comes with several built-in data types. These are the foundational building blocks of the whole language. They have been optimised and perfected over many years. In this comprehensive tutorial, we will explore one of the most important: the dictionary (or dict for short). For your convenience, I’ve created a comprehensive 8000-word eBook which you …

Python Dictionary – The Ultimate Guide Read More »

Python Functions and Tricks Cheat Sheet

Python cheat sheets are the 80/20 principle applied to coding: learn 80% of the language features in 20% of the time.Download and pin this cheat sheet to your wall until you feel confident using all these tricks. Download PDF for Printing Try It Yourself: Exercise: Modify each function and play with the output! Here’s the …

Python Functions and Tricks Cheat Sheet Read More »

Matplotlib Subplot – A Helpful Illustrated Guide

Too much stuff happening in a single plot? No problem—use multiple subplots! This in-depth tutorial shows you everything you need to know to get started with Matplotlib’s subplot() function. If you want, just hit “play” and watch the explainer video. I’ll then guide you through the tutorial: To create a matplotlib subplot with any number …

Matplotlib Subplot – A Helpful Illustrated Guide Read More »