# C3M5 Lesson 2 Practice Lab: Flight delays and cancellations - Working with time series data

**URL:** <https://community.deeplearning.ai/t/c3m5-lesson-2-practice-lab-flight-delays-and-cancellations-working-with-time-series-data/886282>\
**Category:** Python for Data Analytics\
**Tags:** week-module-5, coursera-platform\
**Created:** [January 4, 2026, 6:22pm UTC](https://community.deeplearning.ai/t/c3m5-lesson-2-practice-lab-flight-delays-and-cancellations-working-with-time-series-data/886282 "2026-01-04T18:22:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![VeronikaS](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/veronikas/32/127049_2.png) [@VeronikaS](https://community.deeplearning.ai/u/VeronikaS)\
**Post date:** [January 4, 2026, 6:22pm UTC](https://community.deeplearning.ai/t/c3m5-lesson-2-practice-lab-flight-delays-and-cancellations-working-with-time-series-data/886282/1 "2026-01-04T18:22:27Z")

</div>

Hello!

In the Practice Lab “Flight Delays and Cancellations – Working with Time Series Data” (Course: Python for Data Analytics, Module 5: Time Series), in Step 5: Speed of Changes, we first need to calculate the percentage change for the Arrivals\_Delayed column and save it in the variable cancel\_pct\_change.

Later in this step, we need to find the rows in df\_per\_month where the percentage change is greater than 50%. However, this is done by referring to the variable cancel\_pct\_change, which does not belong to the df\_per\_month DataFrame.

Is it possible to select data from a DataFrame by referring to a variable that does not belong to the DataFrame itself?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![imgabidotcom](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/imgabidotcom/32/138825_2.png) [@imgabidotcom](https://community.deeplearning.ai/u/imgabidotcom)\
**Post date:** [January 5, 2026, 9:38am UTC](https://community.deeplearning.ai/t/c3m5-lesson-2-practice-lab-flight-delays-and-cancellations-working-with-time-series-data/886282/2 "2026-01-05T09:38:51Z")

</div>

Hi @VeronikaS!

The short answer to your question is: yes, it is possible, and this notebook is intentional.

The longer answer:  
The key idea is that pandas selects rows **by index** , not by whether a variable is a column of the DataFrame.

So when you create a _series\_from\_df_ with a certain filter for the _original\_df,_ your _series\_from\_df_ will still have the same indexes that came from the _original\_df_.

When you move on and do something like `original\_df[_series\_from\_df_\>0.5]`, you are basically saying: “_Give me the rows of original\_df with the index that corresponds to True in this series\_from\_df condition_"

This only works because the index of _ **df\_per\_month** _ and _ **cancel\_pct\_change** _ are identical. If they didn’t match, there would be an error.

 ![Screenshot 2026-01-05 at 10.35.28](https://global.discourse-cdn.com/dlai/original/3X/2/b/2bf242e7456eb0a0bf3b56133dc0d5615940a19b.png)

**Happy learning in 2026** 🥳

---

<div class="post-metadata">

**Author:** ![VeronikaS](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/veronikas/32/127049_2.png) [@VeronikaS](https://community.deeplearning.ai/u/VeronikaS)\
**Post date:** [January 7, 2026, 10:01am UTC](https://community.deeplearning.ai/t/c3m5-lesson-2-practice-lab-flight-delays-and-cancellations-working-with-time-series-data/886282/3 "2026-01-07T10:01:35Z")

</div>

@imgabidotcom Thank you for the excellent explanation! I also wish you happy learning and testing in 2026!
