From the course: Complete Guide to Advanced SQL Server

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Solution: Sample a DataFrame

Solution: Sample a DataFrame

I hope you are able to use what you've seen and apply that knowledge to a new problem. Let's walk through the solution together. I asked you to return a random sampling of records, so I'm going to first search through the documentation page for random sample. In most web browsers, you can pull up a search box by typing in Ctrl+F or command F on your keyboard. So I'll search for a random sample. That has one hit on the page, and it's for this function DataFrame.sample. And it says that it returns a random sample of items from an axis of object. And in our case that just means from a DataFrame. So let's go ahead and click on this link to get to the documentation. At the very top, we have an example of what it looks like. So we have DataFrame.sample. In this case, DataFrame is just a placeholder for the name of the DataFrame, so DataFrame.sample. Inside of parentheses, we have a series of parameters. Now, in most documentation, you'll have a list of what the parameters are down below…

Contents