Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Python for Finance Cookbook - Second Edition

You're reading from  Python for Finance Cookbook - Second Edition

Product type Book
Published in Dec 2022
Publisher Packt
ISBN-13 9781803243191
Pages 740 pages
Edition 2nd Edition
Languages
Author (1):
Eryk Lewinson Eryk Lewinson
Profile icon Eryk Lewinson

Table of Contents (18) Chapters

Preface 1. Acquiring Financial Data 2. Data Preprocessing 3. Visualizing Financial Time Series 4. Exploring Financial Time Series Data 5. Technical Analysis and Building Interactive Dashboards 6. Time Series Analysis and Forecasting 7. Machine Learning-Based Approaches to Time Series Forecasting 8. Multi-Factor Models 9. Modeling Volatility with GARCH Class Models 10. Monte Carlo Simulations in Finance 11. Asset Allocation 12. Backtesting Trading Strategies 13. Applied Machine Learning: Identifying Credit Default 14. Advanced Concepts for Machine Learning Projects 15. Deep Learning in Finance 16. Other Books You May Enjoy
17. Index

Visualizing seasonal patterns

As we will learn in Chapter XXX, seasonality plays a very important role in time series analysis. By seasonality, we mean the presence of patterns that occur at regular intervals (shorter than a year). For example, imagine the sales of ice creams, which most likely experience a peak in the summer months, while the sales decrease in winter. And such patterns can be seen year over year. We show how to use the line plot with a slight twist to efficiently investigate such patterns.

In this recipe, we will visually investigate seasonal patterns in the US unemployment rate from the years 2014-2019.

How to do it…

Execute the following steps to create a line plot showing seasonal patterns.

  1. Import the libraries and authenticate:
import pandas as pd
import quandl
import seaborn as sns
 quandl.ApiConfig.api_key = "YOUR_KEY_HERE"
  1. Download and display unemployment data from Quandl:
df = (
    quandl.get(dataset=" FRED/UNRATENSA",
  ...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}