# Manipulating Time Series Data in Python

In this course you'll learn the basics of working with time series data.

Start Course for Free4 Hours16 Videos55 Exercises

## Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.## Loved by learners at thousands of companies

## Course Description

In this course you'll learn the basics of manipulating time series data. Time series data are data that are indexed by a sequence of dates or times. You'll learn how to use methods built into Pandas to work with this index. You'll also learn how resample time series to change the frequency. This course will also show you how to calculate rolling and cumulative values for times series. Finally, you'll use all your new skills to build a value-weighted stock index from actual stock data.

- 1
### Working with Time Series in Pandas

**Free**This chapter lays the foundations to leverage the powerful time series functionality made available by how Pandas represents dates, in particular by the DateTimeIndex. You will learn how to create and manipulate date information and time series, and how to do calculations with time-aware DataFrames to shift your data in time or create period-specific returns.

How to use dates & times with pandas50 xpYour first time series100 xpIndexing & resampling time series50 xpCreate a time series of air quality data100 xpCompare annual stock price trends100 xpSet and change time series frequency100 xpLags, changes, and returns for stock price series50 xpShifting stock prices across time100 xpCalculating stock price changes100 xpPlotting multi-period returns100 xp - 2
### Basic Time Series Metrics & Resampling

This chapter dives deeper into the essential time series functionality made available through the pandas DataTimeIndex. It introduces resampling and how to compare different time series by normalizing their start points.

Compare time series growth rates50 xpCompare the performance of several asset classes100 xpComparing stock prices with a benchmark100 xpPlot performance difference vs benchmark index100 xpChanging the time series frequency: resampling50 xpConvert monthly to weekly data100 xpCreate weekly from monthly unemployment data100 xpUpsampling & interpolation with .resample()50 xpUse interpolation to create weekly employment data100 xpInterpolate debt/GDP and compare to unemployment100 xpDownsampling & aggregation50 xpCompare weekly, monthly and annual ozone trends for NYC & LA100 xpCompare monthly average stock prices for Facebook and Google100 xpCompare quarterly GDP growth rate and stock returns100 xpVisualize monthly mean, median and standard deviation of S&P500 returns100 xp - 3
### Window Functions: Rolling & Expanding Metrics

This chapter will show you how to use window function to calculate time series metrics for both rolling and expanding windows.

Rolling window functions with pandas50 xpRolling average air quality since 2010 for new york city100 xpRolling 360-day median & std. deviation for nyc ozone data since 2000100 xpRolling quantiles for daily air quality in nyc100 xpExpanding window functions with pandas50 xpCumulative sum vs .diff()100 xpCumulative return on $1,000 invested in google vs apple I100 xpCumulative return on $1,000 invested in google vs apple II100 xpCase study: S&P500 price simulation50 xpRandom walk I100 xpRandom walk II100 xpRandom walk III100 xpRelationships between time series: correlation50 xpAnnual return correlations among several stocks100 xp - 4
### Putting it all together: Building a value-weighted index

This chapter combines the previous concepts by teaching you how to create a value-weighted index. This index uses market-cap data contained in the stock exchange listings to calculate weights and 2016 stock price information. Index performance is then compared against benchmarks to evaluate the performance of the index you created.

Select index components & import data50 xpExplore and clean company listing information100 xpSelect and inspect index components100 xpImport index component price information100 xpBuild a market-cap weighted index50 xpCalculate number of shares outstanding100 xpCreate time series of market value100 xpCalculate & plot the composite index100 xpEvaluate index performance50 xpCalculate the contribution of each stock to the index100 xpCompare index performance against benchmark I100 xpCompare index performance against benchmark II100 xpIndex correlation & exporting to Excel50 xpVisualize your index constituent correlations100 xpSave your analysis to multiple excel worksheets100 xpCongratulations!50 xp

Collaborators

Prerequisites

Data Manipulation with pandasStefan Jansen

See MoreFounder & Lead Data Scientist at Applied Artificial Intelligence

Stefan is the Founder & Lead Data Scientist at Applied Artificial Intelligence. He has 15 years of experience in finance and investments, with a big focus on emerging markets.

## Don’t just take our word for it

*4.1

53%

12%

29%

6%

0%

Sort by

- Rafael G.22 days
This course is excellent, I learned many techniques to understand information in Time Series Data.

- Gustavo C.about 1 month
It was, for me, the best course from Datacamp because it was very well structured, the exercises were harder than usually and tested skills from all chapters of the course. The exercises were well written, giving always the name of the variable to create, which allowed to erase the pre-filled exercises (a feature that guts me in DataCamp, the pre-filled exercises).

- Tat Y.2 months
useful

- Jason O.8 months
Informative course and engagingly delivered.

- Christian S.8 months
Great

## Join over 12 million learners and start Manipulating Time Series Data in Python today!

## Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.