Python Tutorial: Time Series Analysis in Python

Publié le: 01 mars 2020
sur la chaîne: DataCamp
1,150
11

Want to learn more? Take the full course at https://learn.datacamp.com/courses/in... at your own pace. More than a video, you'll learn hands-on coding & quickly apply skills to your daily work.

---

Welcome to the first video of the "Introduction to Times Series Analysis Using Python" course. My name is Rob Reider. I'm an Adjunct Professor in the Math-Finance Master's program at NYU's Courant Institute, where I teach a course on Time Series Analysis. I'm also a consultant to a company called Quantopian, which has built a Python-based platform for analyzing and backtesting quantitative trading strategies. Authors of algorithms can enter into paper trading contests and be considered for an allocation of money. Authors receiving allocations are paid 10 percent of the strategy’s net profits, based on their strategy’s individual performance. Also, Quantopian hosts a community where members can ask for help, share ideas, and discuss and share code.

Time series analysis deals with data that is ordered in time. Of course, there are many other types of data that are not covered in this course - for example, cross-sectional data that are taken at one point in time.

Time series comes up in many contexts. Here is a time series of the frequency of Google searches for the word "diet" over a five year period. You can see an interesting pattern: it hits a low around the holidays and then spikes up at the beginning of the year when people make New Year's resolutions to lose weight.

Here is another example of a time series: the average annual temperature in New York City since 1870. Notice that this time series is trending up. Many of the most interesting applications of time series analysis are financial time series. In this course, you will look at a variety of financial time series: stocks, bonds, commodities, even cryptocurrencies like Bitcoin.

Here is the time series of quarterly earnings for the company H&R Block. H&R Block is in the business of preparing tax returns for customers and selling tax software. The vast majority of their earnings occur in the quarter that taxes are due. Notice the strong seasonality pattern in the earnings.

You will also look at two related series in the last chapter of this course. Here are the prices of two energy commodities, heating oil, and natural gas, which move together.

In this course, you will learn about various time series models, fit the data to these models, and use these models to make forecasts of the future.
You will also learn how to use various statistical packages in Python to perform these tasks. Numerous examples will be provided, and I hope that these examples not only demonstrate how to apply these tools but also address some interesting puzzles, mainly in the field of finance.

In the course of analyzing time-series data, you will use several convenient pandas tools for manipulating times series data. These methods will be used repeatedly throughout the course, so we will highlight a few of them now:
to_datetime() is used to convert an index, often read in as a string, into a DateTime index.

The plot method of pandas is a quick way to plot data, and if the index has been converted to a DateTime object, you can slice the data by year, for example. You will sometimes need to merge or join two DataFrames.

For example, one DataFrame may contain stock prices and another DataFrame may contain bond prices.

Pandas makes it easy to resample data. For example, a DataFrame of daily data can be converted to weekly data with the resample method

Often, you will want to convert prices to returns, which you can do with the pct_change method. Or if you want differences, you can use the diff method.
You can compute the correlation of two series using the corr method, and the autocorrelation using the autocorr method. You'll learn more about these methods later in this chapter.

Now let's practice using a few of these time series tools.


Sur cette page du site, vous pouvez voir la vidéo en ligne Python Tutorial: Time Series Analysis in Python durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur DataCamp 01 mars 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 1,150 fois et il a aimé 11 téléspectateurs. Bon visionnage!