BW #52: Border encounters
Has there really been a rise in US border encounters, as reported by Customs and Border Protection? This week, we look at the numbers and origins of non-citizens entering the US without permission.
[Administrative note: Office hours for paid Bamboo Weekly subscribers will take place on Sunday. Come with any and all questions about Pandas! I’ll send a note with the Zoom link in the coming days.]
The Biden administration has committed to providing military aid to Ukraine, Israel, and Taiwan. Of course, it can't do so unless Congress approves such spending; for the most part, Democrats want to approve this spending, while Republicans don't.
A number of senators and representatives put together a compromise bill that would give Democrats foreign military aid, and Republicans money to secure the border further. However, this bill died over the last few days, thanks in no small part to Donald Trump, who told Republicans in Congress to oppose it. Biden has, shrewdly and correctly, already started to point out the hypocrisy of Republicans claiming to want to strengthen the border, but then failing to approve funding to do so when given the chance. A New York Times articles describing the situation is here: https://www.nytimes.com/2024/02/06/us/politics/border-republicans-ukraine-bill.html?unlocked_article_code=1.Tk0.xjzW.OJCxWbtkBliH&bgrp=c&smid=url-share
How many people are really crossing into the US? Where are these people from? And what changes have we seen over time? This week, we’ll examine this data, digging into a topic that has been at the top of the headlines.
Data and nine questions
Borders in the United States are regulated by the Department of Homeland Security's Customs and Border Protection (CBP). They describe "border encounters" as events when their agents come across a non-citizen who isn't allowed to be in the US. There are three different possible results of an encounter:
Expulsion: The person is removed from the US without a hearing of any sort, either to their home country or to the country from which they entered the United States,
Apprehension: The person is found when trying to enter the US illegally. They are usually processed further, which might mean hearings, background checks, and claims of asylum or refugee status.
Inadmissible: The person tries to enter at an established port of entry, and isn't allowed into the US. Again, people at this stage can claim asylum or refugee status.
Our data is a CSV file provided by CBP describing border encounters starting in fiscal year 2021. The main page for downloading the data is at
The file that we'll be examining shows information from fiscal year 2021 through fiscal year 2024, ending in December of FY 2024:
You can get a complete data dictionary from:
Note that you might need to go to the main page in order to download these documents; at least some of the time, I was unable to retrieve them via a direct link.
This week's learning goals include working with dates (including turning fiscal years into calendar years), grouping, resampling, window functions, and plotting.
Here are my 9 tasks annd questions for you. I’ll be back tomorrow with my complete solutions and Jupyter notebook.
Read the data from the CSV file into a data frame. Convert "2024 FYTD" into just "2024".
Create a "date" new column, based on the "Fiscal Year" and "Month (abbv)" columns, containing a datetime value for that year and month based on the fiscal year. Make that the index.