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: Sample a DataFrame - SQL Server Tutorial
From the course: Complete Guide to Advanced SQL Server
Challenge: Sample a DataFrame
It's time for another challenge. You've seen a number of ways to leverage the pandas DataFrame functions to return useful information. The art of programming will always involve applying old skills to new situations. With that in mind, here's what I'd like you to try. First, create a query that selects the CityID and CityName columns from the Application.Cities table. Then load that into a Python DataFrame. Next, I want you to process the data and return 10 random records as a SQL result set. To do this, you'll need to make use of a pandas function that you haven't seen yet. It's called sample. It follows a similar syntax to many of the functions that you have seen. So my hope is, is that you can apply the patterns that you know to a new problem. If you need help, you can take a look through the documentation by searching for random sample on this page of the pandas API reference. I estimate that this challenge should take 10 minutes or less, and in the next movie, I'll show you my…
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)
The Anaconda open-source packages7m 27s
-
(Locked)
Functions in the revoscalepy package1m 48s
-
(Locked)
Model, train, and score with microsoftml1m 16s
-
(Locked)
Produce graphics with Matplotlib7m 53s
-
(Locked)
Get descriptive statistics with pandas7m 45s
-
(Locked)
Challenge: Sample a DataFrame1m 12s
-
(Locked)
Solution: Sample a DataFrame5m 21s
-
(Locked)
-
-
-
-
-