Splitting Your Data Workout
- 02:04
Splitting Your Data WorkoutPractice splitting your data.
Downloads
No associated resources to download.
Transcript
In your Jupyter Notebook, complete the following steps. First, define a new series named Target containing only the target variable available liquidity. Then define a new data frame named inputs containing only the inputs from the liquidity dataset. Finally, display the first row of each new object In order to define the new inputs data frame, use the drop function in the format that you see here. First, the new data frame name, and then set that equal to the original data frame, name dot drop, and then in single quotes, the name of the series to drop, comma, and then the argument axis equals 1. The axis equals 1 argument indicates that you want to drop a column, whereas the axis equals 0 argument indicates that you want to drop a row. Remember, you can refer to a series within a existing data frame using the data frame name, dot series, name, format, or the data frame, name, square brackets, and then series name and single quotations.
First, I'm creating a Pandas series that contains only the target variable available liquidity, And that's already contained inside of our data frame liquidity data. So I'm going to liquidity data Pointing towards the series, available liquidity, And then I'm storing that series in this new variable target. Second, I'm creating this new data frame called inputs, and inputs is my existing data frame liquidity data, but dropping the available liquidity series. And then that access 1 argument just means that I'm dropping a column, whereas access 0 would mean that I'm dropping a row, I'm going to execute That cell to create these two new variables, that series and the new data frame, and to verify that I've done it correctly, I'm going to display The first row with the head function, and you should get the same answers that you see here.