Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Data Analysis with Scala

You're reading from   Hands-On Data Analysis with Scala Perform data collection, processing, manipulation, and visualization with Scala

Arrow left icon
Product type Paperback
Published in May 2019
Publisher Packt
ISBN-13 9781789346114
Length 298 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Rajesh Gupta Rajesh Gupta
Author Profile Icon Rajesh Gupta
Rajesh Gupta
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Section 1: Scala and Data Analysis Life Cycle FREE CHAPTER
2. Scala Overview 3. Data Analysis Life Cycle 4. Data Ingestion 5. Data Exploration and Visualization 6. Applying Statistics and Hypothesis Testing 7. Section 2: Advanced Data Analysis and Machine Learning
8. Introduction to Spark for Distributed Data Analysis 9. Traditional Machine Learning for Data Analysis 10. Section 3: Real-Time Data Analysis and Scalability
11. Near Real-Time Data Analysis Using Streaming 12. Working with Data at Scale 13. Another Book You May Enjoy

Using Spark to explore data

Spark's SQL provides a convenient way to explore data and gain a deeper understanding of the data. Spark's DataFrame construct can be registered as temporary tables. It is possible to run SQL on these registered tables by performing all of the normal operations, such as joining tables and filtering data.

Let's look at an example Spark shell to learn how to explore data by using the following steps:

  1. Start the Spark shell in a Terminal as follows:
$ spark-shell
  1. Define the following Scala case called Person with the following three attributes:
    • fname: String
    • lname: String
    • age: Int
scala> case class Person(fname: String, lname: String, age: Int)
defined class Person
  1. Create a Scala list consisting of a few persons and put it into a Spark dataset of Person as follows:
scala> val personsDS = List(Person("Jon", "Doe...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image