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.

Convert a series to a data frame

Convert a series to a data frame

From the course: SQL Server Machine Learning Services: Python

Start my 1-month free trial

Convert a series to a data frame

- [Instructor] Before you can pass data out of a Python script back to a SQL Server result set it first needs to pass through a number of data containers. The process is going to look something like this. A collection of single scalar values are grouped together into a Python list. Then the list can be converted into a pandas series. From there, the series gets converted into a pandas data frame. A data frame is another pandas construct like a series but where a series can only include a single column of values, a data frame can contain one or more columns. Finally, the data frame can be assigned to the output data set variable and the contents are passed back to a SQL Server result set. Let's take a look at all of the steps in a single script. I'm starting with a couple of scalars, A, B, and C, that contain text strings. First, I need to put these into a list. That's done with square bracket notation and each scalar gets separated by commas. Then the list gets converted into a…

Contents