From the course: SQL Server Machine Learning Services: Python

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Slice a data frame to series

Slice a data frame to series

From the course: SQL Server Machine Learning Services: Python

Start my 1-month free trial

Slice a data frame to series

- [Instructor] When we bring data in from SQL server through the input data one parameter, it imports a data frame. In order to work with the values in Python, it might be useful to break that data frame into individual series, one series from each column in the input dataset. Let's take a look at how to do this by importing some data. I've got a select statement here. It says SELECT TOP 10 CityID and city name columns from the Application.Cities table. It's going to highlight all of that and execute it so we can see our starting data. And this is the data that I'm importing into my Python script. So right now we're going to have a data frame called InputDataSet that has two columns. To break them into individual columns, we can make reference to their column indexes. Just like with row indexing that starts with zero to represent the first row in the data frame, column index zero represents the first column in the data frame. So to split up these two columns, we want to separate…

Contents