From the course: Introduction to Spark SQL and DataFrames
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Filter data with DataFrame API
From the course: Introduction to Spark SQL and DataFrames
Filter data with DataFrame API
- [Instructor] Now let's take a look at how we can use the Dataframe API to filter some of the rows in our Dataframe. I uploaded the location temp csv file and again that's time series data that has a location ID and a temperature measurement at a particular point and time. Now we have a number of different locations. So, for example, if we wanted to see all of a particular location, we could specify a Dataframe name in this case df1, and we want to apply the filter command or filter method. And what we want to do is we want to specify that the Dataframe 1 location ID column should be equal to, let's call it loc0, location 0. And that'll return some results and let's make sure we show those results. And what you'll notice here is we got 20 rows of location 0 but how many are there? Let's take a look at how we can get a count for the results of a filter. So let's filter Dataframe 1 using the filter method.…
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)
Set up a Jupyter notebook2m 1s
-
(Locked)
Load data into DataFrames: CSV Files7m 26s
-
(Locked)
Load data into DataFrames: JSON Files3m 16s
-
(Locked)
Basic DataFrame operations3m 26s
-
(Locked)
Filter data with DataFrame API2m 13s
-
(Locked)
Aggregate data with DataFrame API3m 47s
-
(Locked)
Sample data from DataFrames5m 25s
-
(Locked)
Save data from DataFrames3m 27s
-
(Locked)
-
-
-