2. Create a Pandas DataFrame that's 10 x 5 in size, filled with random numbers ranging from 0 to 100\. Name the five columns as follows: **["Week1", "Week2", "Week3", "Week4", "Week5"]**.
data = pd.DataFrame(np.random.randint(0,100,size=(10, 5)),
columns=['Week1','Week2','Week3',\
'Week4','Week5'])
data
```
注意
...
...
@@ -166,15 +164,17 @@
3. Create an input and a target variable, considering that the input variable should contain all the values of all the instances, except the last column of data. The target variable should contain all the values of all the instances, except the first column:
输入= data.iloc [:,:-1]
目标= inputs.shift(-1,axis =“ columns”,\
fill_value = data.iloc [:,-1:])
```py
inputs = data.iloc[:,:-1]
targets = inputs.shift(-1, axis="columns", \
fill_value=data.iloc[:,-1:])
```
4. Print the input variable to verify its contents, as follows:
输入
```py
inputs
```
输入变量应如下所示:
...
...
@@ -184,7 +184,9 @@
5. Print the resulting target variable using the following code: