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.
Challenge: Sample a data frame
From the course: SQL Server Machine Learning Services: Python
Challenge: Sample a data frame
(upbeat electronic music) - [Instructor] It's time for another challenge. You've seen a number of ways to leverage the pandas data frame functions to return useful information. The art of programming will always involve applying old skills to new situations. With that 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 data frame. 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…
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 data frame1m 12s
-
(Locked)
Solution: Sample a data frame5m 21s
-
(Locked)
-
-
-
-