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
From the course: SQL Server Machine Learning Services: Python
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Return values with indexes and series6m 8s
-
(Locked)
Convert a series to a data frame4m 40s
-
(Locked)
Add multiple series to a data frame3m 12s
-
(Locked)
Include the index in a data frame4m 44s
-
(Locked)
Slice a data frame to series4m 23s
-
(Locked)
Challenge: Import and process data52s
-
(Locked)
Solution: Import and process data6m 44s
-
(Locked)
-
-
-