Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please complete full question csv file sample: Date generation 2022-01-01 0:00 1671.13 2022-01-01 1:00 1698.46 2022-01-01 2:00 1707.5 2022-01-01 3:00 1723.35 2022-01-01 4:00 1514.91 2022-01-01
Please complete full question
csv file sample:
Date | generation |
2022-01-01 0:00 | 1671.13 |
2022-01-01 1:00 | 1698.46 |
2022-01-01 2:00 | 1707.5 |
2022-01-01 3:00 | 1723.35 |
2022-01-01 4:00 | 1514.91 |
2022-01-01 5:00 | 1326.99 |
2022-01-01 6:00 | 1391.01 |
The actual file has thousands of rows.
You are asked to generate features from a time series data stored in wind.csv. You will read the csv into DataFrame called wind then add new columns inside DataFrame wind. a) Read wind.csv into DataFrame called wind. (3 points) H \# YOUR CODE HERE b) Change data type of Date column to datetime64 and set Date as the index of DataFrame wind. (7 points) H \# YOUR CODE HERE c) Create a new column called "hour" inside DataFrame wind where the value in each row of column "hour" equals to the hour of that index. (5 points) M \# YOUR CODE HERE d) Create a new column called "hour_ sin inside DataFrame wind where the values in each row of column "hour_sie" equals to sine of "hour". (5 points) Hint: Math is sin(242hour). M \# YOUR CODE HERE e) Create a new column called "hour_cos" inside DataFrame wind where the values in each row of column "hour_cos" equals to cosine of "hour". (3 points) Hint: Math is cos(242hour). H \# YOUR CODE HERE f) Create a new column called "lag 1 " inside DataFrame wind. Fill this column by shifting "generation" column by 1-hour. (5 points) M \# YOUR CODE HERE f) Create a new column called "rolling mean" inside DataFrame wind. Fill this column by calculating rolling mean of "generation" with 5-hours window. (5 points) M \# YOUR CODE HERE g) Create a new column called "roc" inside DataFrame wind where rows show the rate of change of "generation" for each hour. (7 points) Hint: Math is roct=generationt1generationtgenerationt1 where t shows each row. M \# YOUR CODE HERE h) Drop rows of wind that have NA values. Make the dropping inplace. (5 points)Step 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