5 Best Ways to Find Common Elements in Two Pandas DataFrames

πŸ’‘ Problem Formulation: When working with data in Python, it’s a common scenario to need to identify common elements between two dataframes. For example, you might have two lists of user IDs from different sources and want to find which IDs are present in both lists. This article will explore five methods to find these … Read more

Python: Create List of Tuples from DataFrame

πŸ’‘ Problem Formulation: When working with pandas DataFrames, you might require converting the data into a list of tuples, where each tuple represents a row in the DataFrame. Suppose we have a DataFrame containing employee information with columns [‘Name’, ‘Age’, ‘Department’], the desired output is a list of tuples like [(‘Alice’, 30, ‘HR’), (‘Bob’, 22, … Read more

6 Ways to Count Number of Rows in Pandas DataFrame

This article outlines various approaches to finding the row count in a DataFrame when working with the pandas library. πŸ’‘ Problem Formulation: Determine the total number of rows in a Pandas DataFrame, a 2-dimensional labeled data structure, to understand the dataset’s size. For example, given a DataFrame df with sales data, find out how many … Read more

Buy and Hold Through Change! $600 Monthly to $500K in 10 Years with Tech Stocks

πŸ’‘ Disclaimer: This isn’t financial advice! DYOR and talk to a professional before making any investment decisions. Finxter is all about staying on the right side of change. I have always believed in simple strategies like buying and holding good companies. This backtesting study peeks into the past decade, mapping out a journey where a … Read more

Yahoo-Fin: Fetching Historical Stock Data with Python’s Yahoo Finance API

This guide provides an easy-to-understand foundation for beginners and intermediate users to leverage the Yahoo Finance API with Python for financial data analysis. Yahoo Finance API offers a wealth of financial data, from stock prices and market trends to currency exchange rates. This guide will introduce you to using the Yahoo Finance API yahoo_fin with … Read more

10 Best Ways to Create a Pandas Series

To create a Pandas Series for different data types, start by importing the Pandas library in Python using import pandas as pd. Then, create a Series object by using pd.Series(data), where data can be a list, array, or dictionary containing elements of various data types like integers, strings, or floats. Finally, you can specify the … Read more

Parsing Excel Sheets into Text Files and Lists with Python

Python provides robust tools for handling Excel files, and this article will guide you through the process of parsing Excel sheets into different formats using Python. To parse Excel sheets into text files and lists in Python, use the pandas library. Install pandas and openpyxl, then read the Excel file with pd.read_excel(). Convert the DataFrame … Read more

Matplotlib Colors: A Comprehensive Guide for Effective Visualization

Here’s a minimal example of using colors in Matplotlib. This example creates a simple line plot with a specified color: In this minimal code example, plt.plot(x, y, color=’red’) creates a line plot of x versus y, with the line color set to red. You can replace ‘red’ with other color names like ‘blue’, ‘green’, etc., … Read more

Python vs Go – Which Language Should You Choose in 2024

Both Python and Go are extremely relevant today. Both languages are widely used. Golang fans argue that people flock from Python to the newer and faster language Golang, also known as Go. Is this true? Not really. See this search volume comparison from Google Trends: πŸ‘‡ Go is a much newer language than Python, released … Read more

Python Code for Getting Historical Weather Data

To get historical weather data in Python, install the Meteostat library using pip install meteostat or run !pip install meteostat with the exclamation mark prefix ! in a Jupyter Notebook. If you haven’t already, also install the Matplotlib library using pip install matplotlib. Then, copy the following code into your programming environment and change the … Read more

Want Exploding Bitcoin Prices North of $500,000 per BTC? “Grow N” Says Metcalfe’s Law

Metcalfe’s law states that the value of a network (V) is proportional to the square of the number of connected users of the system (NΒ²). In this article, I’ll develop a Bitcoin price prediction (V) in the year 2030 based on the average growth rate of the number of Bitcoin nodes (N). General Intuition Metcalfe’s … Read more

Top 10 LLM Training Datasets – It’s Money Laundering for Copyrighted Data!

I’ve read the expression of large language models (LLMs) being “Money Laundering for Copyrighted Data” on Simon Willison’s blog. In today’s article, I’ll show you which exact training data sets open-source LLMs use, so we can gain some more insights into this new alien technology and, hopefully, get smarter and more effective prompters. Let’s get … Read more