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
Conferences
Free Learning
Arrow right icon
Getting Started with Haskell Data Analysis
Getting Started with Haskell Data Analysis

Getting Started with Haskell Data Analysis: Put your data analysis techniques to work and generate publication-ready visualizations

eBook
€8.99 €15.99
Paperback
€19.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Getting Started with Haskell Data Analysis

SQLite3

In this chapter, we are going to learn about SQLite3. SQLite3 is a file format for storing data in the same mindset of a relational database such as Oracle, MySQL, MariaDB, and Postgres. Well, I suppose that you could use SQLite3 as a traditional database engine, but it's really not made for that. SQLite3 allows us to open up a file, work with the data in that file using SQL statements, and then close that file. One file can contain one database, and a database can store multiple tables of information. Contrast this with the CSV file format that we used in the last chapter which, at best, stores a single table of information. The advantages of SQLite3 are that it doesn't require any server-side programs running in the background, there are no configurations to discuss, and the executable for working with SQLite3 is a single file. So, in my opinion, working with...

SQLite3 command line

This section is going to be a primer on SQLite3 and it won't have any Haskell code. We're going to take a moment, and translate a CSV file into SQLite3. In this section, we're going to take a look at introducing SQLite3; we will be creating a table in an SQLite3 database, and also adding a CSV file to that table that we created in our SQLite3 database.

So, let's go to our Haskell environment and open our browser. Using Google, search for usgs earthquake feed csv. USG is the United States Geological Survey, and they keep a database of every single earthquake that takes place on planet earth, and they offer this data in a CSV file. So, we're going to click that very first link, https://earthquake.usgs.gov/earthquakes/feed/v1.0/csv.php. You should see Spreadsheet Format at the top; scroll down to the heading where it says Past 7 Days...

Working with SQLite3 and Haskell

In this section, we will talk about getting data from SQLite3 into Haskell. We're going to understand the basic types within SQLite3 and their Haskell counterparts. We're also going to be installing the necessary software in order to get Haskell and SQLite3 to communicate with each other, and we're going to be writing a few SELECT queries within Haskell.

There are a few different data types in SQLite3 with their Haskell counterparts:

The four primary types are INTEGER, REAL, TEXT, and BLOB; TEXT and BLOB are almost the same types. One is for raw data and the other is for string data, but we can interpret both of those in Haskell as String. INTEGER corresponds to Integer; REAL corresponds to Decimal. There is a fifth type in SQLite3 called NUMERIC, which is adaptive and is treated as an integer with INTEGER data and a real with...

Slices of data

This section will be an overview of the versatility of the SELECT query in SQLite3. Most of the content of this section will pertain to the inner workings of the SELECT query, and not the Haskell language itself. We're going to have an understanding of the following SELECT clauses: WHERE, ORDER BY, and LIMIT. Each of these have their own utility, but when these clauses work together you can quickly see how data can be sliced into workable chunks that can be studied later. This is my preferred way of working with data where we let SQL do the slicing and Haskell do the dicing. Once we have a data slice that we're happy with, we'll spend some time at the end looking at how to parse that chunk of data into something usable by Haskell.

Let's go back to our Jupyter Notebook; we will flop over to our primary Earthquakes notebook. We will begin with...

Working with SQLite3 and descriptive statistics

So far, we've seen how to generate an SQLite3 database using the sqlite3 command-line utility, and how to interact with that database within Haskell. This section combines the knowledge of descriptive statistics from Chapter 1, Descriptive Statistics, with our database work in Chapter 2, SQLite3. We will be using descriptive statistics with our SQLite3 database in this section. First, we will create our descriptive statistics module from functions found in our Baseball notebook. Second, we will slice up some data using SELECT queries. Third, we will pass data to our descriptive statistics functions, and discuss the results. We'll be looking at earthquakes, specifically in the region of Oklahoma. So, let's glide over to our virtual machine running our IHaskell Notebook, and what I would like to do is to discuss how...

Summary

In this chapter, we installed the sqlite3 command-line utility and installed the necessary SQLite3 libraries for working with data in the IHaskell environment. Most data doesn't come in SQLite3 format, but in CSV format. So, we covered how to convert a CSV file into an SQLite3 table. We explored the versatility of SELECT queries in SQLite3 by means of the WHERE clause, the ORDER BY clause, and the LIMIT clause. We also explored how to create our own custom module of descriptive statistics, and then we used that module in order to study earthquake data in the IHaskell environment. In our next chapter, we're going to take a look at regular expressions in Haskell.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Take your data analysis skills to the next level using the power of Haskell
  • Understand regression analysis, perform multivariate regression, and untangle different cluster varieties
  • Create publication-ready visualizations of data

Description

Every business and organization that collects data is capable of tapping into its own data to gain insights how to improve. Haskell is a purely functional and lazy programming language, well-suited to handling large data analysis problems. This book will take you through the more difficult problems of data analysis in a hands-on manner. This book will help you get up-to-speed with the basics of data analysis and approaches in the Haskell language. You'll learn about statistical computing, file formats (CSV and SQLite3), descriptive statistics, charts, and progress to more advanced concepts such as understanding the importance of normal distribution. While mathematics is a big part of data analysis, we've tried to keep this course simple and approachable so that you can apply what you learn to the real world. By the end of this book, you will have a thorough understanding of data analysis, and the different ways of analyzing data. You will have a mastery of all the tools and techniques in Haskell for effective data analysis.

Who is this book for?

This book is intended for people who wish to expand their knowledge of statistics and data analysis via real-world examples. A basic understanding of the Haskell language is expected. If you are feeling brave, you can jump right into the functional programming style.

What you will learn

  • Learn to parse a CSV file and read data into the Haskell environment
  • Create Haskell functions for common descriptive statistics functions
  • Create an SQLite3 database using an existing CSV file
  • Learn the versatility of SELECT queries for slicing data into smaller chunks
  • Apply regular expressions in large-scale datasets using both CSV and SQLite3 files
  • Create a Kernel Density Estimator visualization using normal distribution

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 31, 2018
Length: 160 pages
Edition : 1st
Language : English
ISBN-13 : 9781789808605
Category :
Languages :
Concepts :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Oct 31, 2018
Length: 160 pages
Edition : 1st
Language : English
ISBN-13 : 9781789808605
Category :
Languages :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 91.97
Haskell Cookbook
€41.99
Haskell Design Patterns
€29.99
Getting Started with Haskell Data Analysis
€19.99
Total 91.97 Stars icon
Banner background image

Table of Contents

7 Chapters
Descriptive Statistics Chevron down icon Chevron up icon
SQLite3 Chevron down icon Chevron up icon
Regular Expressions Chevron down icon Chevron up icon
Visualizations Chevron down icon Chevron up icon
Kernel Density Estimation Chevron down icon Chevron up icon
Course Review Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.