The World’s Most Expensive Database: $30 Million per GB

As data becomes more and more abundant, digital scarcity becomes more valuable. Let me explain. Imagine a world where robots built houses for free. The abundance on one side (=houses) increases the scarcity on the other side (=land). Consequently, prices of land would skyrocket. Similarly, digital bots and generative AI create floods of digital information, … Read more

Python 🐍 Put Legend Outside Plot πŸ“ˆ – Easy Guide

Are you tired of feeling boxed in by your Python plots and ready to break free from the constraints of traditional legend placement? In this guide, I’ll show you how to put legends outside your plot for (click to 🦘 jump): Let’s start with the first! πŸ‘‡πŸ‘©β€πŸ’» Matplotlib Put Legend Outside Plot Let’s start with … Read more

Python List of Tuples to DataFrame 🐼

To convert a list of tuples to a Pandas DataFrame, import the pandas library, call the DataFrame constructor, and pass the list of tuples as the data argument such as in pd.DataFrame(tuples_list, columns=[‘Number’, ‘Letter’]). Here’s a minimal example: The output of the given code will be a Pandas DataFrame with two columns, ‘Number’ and ‘Letter’, … Read more

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