Question
The file ApplianceShipments.csv contains the series of quarterly shipments (in millions of dollars) of US household appliances between 1985 and 1989. Quarter Shipments Q1-1985 4009
The file ApplianceShipments.csv contains the series of quarterly shipments (in millions of dollars) of US household appliances between 1985 and 1989.
Quarter | Shipments |
Q1-1985 | 4009 |
Q2-1985 | 4321 |
Q3-1985 | 4224 |
Q4-1985 | 3944 |
Q1-1986 | 4123 |
Q2-1986 | 4522 |
Q3-1986 | 4657 |
Q4-1986 | 4030 |
Q1-1987 | 4493 |
Q2-1987 | 4806 |
Q3-1987 | 4551 |
Q4-1987 | 4485 |
Q1-1988 | 4595 |
Q2-1988 | 4799 |
Q3-1988 | 4417 |
Q4-1988 | 4258 |
Q1-1989 | 4245 |
Q2-1989 | 4900 |
Q3-1989 | 4585 |
Q4-1989 | 4533 |
# Convert the data frame to be suitable for time series analysis
# 1. Create date range for quarters (already completed) date_range = pd.date_range(start='1/1/1985', end='12/31/1989', freq='Q')
# 2. Recreate the shipments_df dataframe but drop the first column (already completed) # Format for filtering dataframes --> # [rowStart:rowEnd, columnStart:columnEnd] shipments_df = shipments_df.iloc[0: , 1:2]
# 3. Add the date_range column to the shipments_df dataframe and make sure it is a DATETIME datatype # MISSING: one line of code needed. # HINT: use the pd.to_datetime() function
# 4. Convert the Pandas dataframe called shipments_df into a pandas series called shipment_ts # - Make the date column the Index # - Use the Shipments column .values as the data # MISSING: one line of code needed.
#5. Print the resulting Pandas series # MISSING: one line of code needed.
output:
Out[26]: Date 1985-03-31 1985-06-30 1985-09-30 1985-12-31 1986-03-31 1986-06-30 1986-09-30 1986-12-31 1987-03-31 1987-06-30 1987-09-30 1987-12-31 1988-03-31 1988-06-30 1988-09-30 1988-12-31 1989-03-31 1989-06-30 1989-09-30 1989-12-31 dtype: int64 4009 4321 4224 3944 4123 4522 4657 4030 4493 4806 4551 4485 4595 4799 4417 4258 4245 4900 4585 4533Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started