I have the following data frame.
--------------------------------
Year & Quarter| GDP | Change |
--------------------------------
2000q1 | 12359 | -----
2000q2 | 12592 | increase
2000q3 | 12607 | increase
2000q4 | 12679 | increase
---------------------------------
I want to find a pattern of data within the 'change' column to determine a recession period within the data.
RecessionCriteria = ('decline', 'decline', 'increase', 'increase')
df.query('GDP.str.contains(@RecessionCriteria)')
Expected results should be the year and the quarter eg. 2008q1
Aucun commentaire:
Enregistrer un commentaire