1
Q 1 ] Read the data as an appropriate Time Series data and plot the data.
Both Datasets are read and stored as Pandas Data Frames for analysis
• Datasets are read as Time Series data using parse_dates=True &
index_col=‘YearMonth’
• First 5 rows of both the data are given below -
YearMonth Rose YearMonth Sparkling
1980-01-01 112.0 1980-01-01 1686
1980-02-01 118.0 1980-02-01 1591
1980-03-01 129.0 1980-03-01 2304
1980-04-01 99.0 1980-04-01 1712
1980-05-01 116.0 1980-05-01 1471
Rose Data Header Sparkling Data Header
• Rose Data plot -
Soba C
2
• Sparkling Data plot -
[ Q 2 ] Perform appropriate Exploratory Data Analysis to understand the data and
also perform decomposition.
Exploratory Data Analysis -
count mean std min 25% 50% 75% max
3
Rose 187.0 89.914 39.238 28.0 62.5 85.0 111.0 267.0
1070.
Sparkling 187.0 2402.417 1295.112 1605.0 1874.0 2549.0 7242.0
0
Descriptive Stats of Rose and Sparkling datasets
<class 'pandas.core.frame.DataFrame'> # Column Non-Null Count Dtype
DatetimeIndex: 187 entries, --- ------ -------------- -----
1980-01-01 to 1995-07-01 Data 0 Sparkling 187 non-null int64
columns (total 1 columns): dtypes: int64(1) memory
# Column Non-Null Count Dtype usage: 2.9 KB
--- ------ -------------- -----
0 Rose 187 non-null float64
dtypes: float64(1) memory usage: 2.9
Info - Sparkling data
KB
Info - Rose data
• Month-wise Boxplot of Rose -
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 187 entries,
1980-01-01 to 1995-07-01 Data
columns (total 1 columns):
4
• Month-wise Boxplot of Sparkling -
• Sales of both - Rose and Sparkling, show a spike in the last quarter of Oct to Dec
• Spike is much more accentuated in Sparkling sales
• This spike may be due to the Holiday season starting in Oct
YearMonth trend YearMonth seasonal YearMonth resid
1980-01-01 1980-01-01 -27.91 1980-01-01
Additive Decomposition of Rose -
1980-02-01 1980-02-01 -17.44 1980-02-01
1980-03-01 1980-03-01 -9.29 1980-03-01
1980-04-01 1980-04-01 -15.10 1980-04-01
1980-05-01 1980-05-01 -10.20 1980-05-01
1980-06-01 1980-06-01 -7.68 1980-06-01
1980-07-01 147.08 1980-07-01 4.90 1980-07-01 -33.98
1980-08-01 148.13 1980-08-01 5.50 1980-08-01 -24.62
1980-09-01 148.38 1980-09-01 2.77 1980-09-01 53.85
1980-10-01 148.08 1980-10-01 1.87 1980-10-01 -2.96
5
1980-11-01 147.42 1980-11-01 16.85 1980-11-01 -14.26
1980-12-01 145.13 1980-12-01 55.71 1980-12-01 66.16
Rose Trend Rose Seasonality