From the course: Complete Guide to Advanced SQL Server
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Slice a DataFrame to series - SQL Server Tutorial
From the course: Complete Guide to Advanced SQL Server
Slice a DataFrame to series
When we bring data in from SQL Server through the input_data_1 parameter, it imports a DataFrame. In order to work with the values in Python, it might be useful to break that DataFrame into individual series, one series from each column in the input data set. 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 CityName columns FROM the Application.Cities table. It's going to highlight all of that and execute it so you 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 DataFrame 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 DataFrame, column index zero represents the first column in the DataFrame. So to split out these two columns, we want to separate column zero, the first…
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 DataFrame4m 40s
-
(Locked)
Add multiple series to a DataFrame3m 12s
-
(Locked)
Include the index in a DataFrame4m 44s
-
(Locked)
Slice a DataFrame to series4m 23s
-
(Locked)
Challenge: Import and process data52s
-
(Locked)
Solution: Import and process data6m 44s
-
(Locked)
-
-
-
-