Pandas Boolean Indexing

Boolean indexing in Pandas filters DataFrame rows using conditions. Example: df[df[‘column’] > 5] returns rows where ‘column’ values exceed 5. Efficiently manage and manipulate data with this method. Here’s an easy example: This code creates a DataFrame with data for four people, then uses boolean indexing to filter out the rows with an age greater … Read more

How to Create a Sample Spreadsheet With Dummy Data Using ChatGPT: A Concise Guide

I rely on spreadsheets every day to manage my business, make informed financial choices, and organize lists that help structure my day. My business simply couldn’t function without the aid of spreadsheets. πŸ“ˆ Spreadsheets are immensely useful tools for managing and analyzing data. Among their many features, one invaluable capability is πŸ’» generating sample data … Read more

How I Scattered My Fat with Python – Scraping and Analyzing My Nutrition Data From Cronometer.com

From April 1st through August 14th, I tracked everything I ate on cronometer.com as part of a weight loss challenge. Overall I lost almost 25 pounds at a rate of 1.2 pounds per week. I always wondered what I could learn if I could scrape that data and get it into a Jupyter Notebook. In … Read more

Python Int to String with Leading Zeros

To convert an integer i to a string with leading zeros so that it consists of 5 characters, use the format string f'{i:05d}’. The d flag in this expression defines that the result is a decimal value. The str(i).zfill(5) accomplishes the same string conversion of an integer with leading zeros. Challenge: Given an integer number. … Read more

How To Extract Numbers From A String In Python?

The easiest way to extract numbers from a Python string s is to use the expression re.findall(‘\d+’, s). For example, re.findall(‘\d+’, ‘hi 100 alice 18 old 42’) yields the list of strings [‘100′, ’18’, ’42’] that you can then convert to numbers using int() or float(). There are some tricks and alternatives, so keep reading … Read more

Data Science Tells This Story About the Global Wine Markets 🍷

πŸ“– Background Many people like to relax or party with a glass of wine. That makes wine an important industry in many countries. Understanding this market is important to the livelihood of many people. For fun, consider the following fictional scenario: 🍷 Story: You work at a multinational consumer goods organization that is considering entering … Read more

How I Created a Football Prediction App on Streamlit

This tutorial shows you how I created a model to predict football results using Poisson distribution. You’ll learn how I designed an interactive dashboard on Streamlit where our users can select a team and get to know the odds of a home win, draw, or away win. Here’s a live demo of using the app … Read more

Basketball Statistics – Page Scraping Using Python and BeautifulSoup

In this blog series, powerful Python libraries are leveraged to help uncover some hidden statistical truths in basketball. The first step in any data-driven approach is to identify and collect the data needed. Luckily for us, Basketball-Reference.com hosts pages of basketball data that can be easily scraped. The processes of this walkthrough can be easily … Read more

How to Normalize a NumPy Matrix

In this blog post, we’ll discuss how to normalize a matrix using the popular Python library NumPy. But first things first: πŸ‘‡ What is Normalization? In mathematics, normalizing refers to making something standardized or regular. Normalization of a matrix is a process of scaling the matrix so that the elements of the matrix have a … Read more

The Ultimate Guide to Bivariate Analysis with Python

This article will review some of the critical techniques used in Exploratory Data Analysis, specifically for Bivariate Analysis. We will review some of the essential concepts, understand some of the math behind correlation coefficients and provide sufficient examples in Python for a well-rounded, comprehensive understanding. What is Bivariate Analysis? Exploratory Data Analysis, or EDA, is … Read more