Python 3

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 »

[Basics Computer Science] A Recursive Pathfinder Algorithm in Python

[python] def find_path(graph, v_start, v_end, path_len=0): ”’Is there a path between vertex v_start and vertex v_end?”’ # Traverse each vertex only once if path_len >= len(graph): return False # Direct path from v_start to v_end? if graph[v_start][v_end]: return True # Indirect path via neighbor v_nbor? for v_nbor, edge in enumerate(graph[v_start]): if edge: # between v_start …

[Basics Computer Science] 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?

NumPy’s average function computes the average of all numerical values in a NumPy array. When used without parameters, it simply calculates the numerical average of all values in the array, no matter the array’s dimensionality. For example, the expression np.average([[1,2],[2,3]]) results in the average value (1+2+2+3)/4 = 2.0. However, what if you want to calculate …

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

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

[python] import numpy as np # stock prices (3x per day) # [morning, midday, evening] solar_x = np.array( [[2, 3, 4], # day 1 [2, 2, 5]]) # day 2 print(np.average(solar_x)) [/python] What is the output of this puzzle? *Beginner Level* (solution below) Numpy is a popular Python library for data science focusing on arrays, …

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