Pandas’ 2.0 Release Deprecated Your Favorite Method. What Now?
Pandas’ 2.0 update deprecates a function so popular it’s in the top 10 docs searches. How to adjust your data transformations.
If you want to use Pandas in a data science project and don’t know where to start, jumpstart a job-worthy portfolio with my free, 5-page guide.
How To Solve The Pandas .Append() Error
Depending on the day, Pandas is my favorite/least favorite Python package. Pandas is quickly cleaning up an API response and loading to a data frame? Favorite. Pandas is incorrectly inferring dtypes which leads to a broken pipeline and a ruined day before breakfast? Least favorite.
One of my favorite functions in Pandas (and yeah, I realize how nerdy it is to have a favorite function), is the .append() method. For someone in my role who spends most days interacting with APIs returning data in different forms, .append() is a quickly implemented catch-all solution when it comes to creating a data frame from a list of dicts within a JSON payload, which is common in API-based data sources.
In addition to a few QA queries that are burned into my subconscious, this is a method that I do so much I nearly see it in my sleep.
# Hypothetical example
import requests
import pandas as pd
base_url = "https://api.stripe.com/v1/payouts"
req = requests.get(url, headers)
df =…