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.

Challenge: Import a DataFrame

Challenge: Import a DataFrame

We've seen a number of techniques for working with Python code in SQL Server, so let's apply some of those skills to a challenge. In the Wide World Importers database, take a look at the Warehouse.Colors table. You'll find a column called ColorName and one called ColorID. We'll use these for our data source. First, select all of the rows with a color ID above 20 and then import them into a Python data frame. Next, create a script that will print out some statistics about the data frame to the messages window. We saw how to use the shape data frame property to return the number of rows and columns that it contains. There's another property called size, and it returns the number of elements or cells that the data frame contains. We didn't look at size, but the syntax is identical to shape. See if you can get useful information from both of these. Finally, export the first ten rows of the data frame to a SQL Server result set. It's possible to perform all of these tasks in a single…

Contents