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
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Mathematica Data Analysis
Mathematica Data Analysis

Mathematica Data Analysis: Learn and explore the fundamentals of data analysis with power of Mathematica

eBook
$20.98 $29.99
Paperback
$38.99
Subscription
Free Trial
Renews at $19.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

Mathematica Data Analysis

Chapter 2. Broad Capabilities for Data Import

In order to process and analyze data, it is necessary to be able to import data into Mathematica. However, the data may not be always in a convenient format; they may contain errors, may be incomplete, or on the contrary—they may contain redundant information. Therefore, in order to learn how to import data, you will understand the following from this chapter:

  • What types of data can be imported in Mathematica?
  • What built-in functions are used for importing?
  • How to check data for completeness
  • How to clean the data and transform them into a convenient format for analysis

Permissible data format for import

Mathematica allows the importing of hundreds of data formats, but we only need some of them: those that are amenable to mathematical processing and analysis.

The main data formats can be divided into the following groups:

  • Tabular Text Formats: This includes general text format data (*.dat), comma-separated (*.csv), or tab-separated (*.tsv)
  • Spreadsheet Formats: This includes office programs data working with documents, such as Excel (*.xls and *.xlsx), Open Office (*.odc, and *.sxc), and even the first spreadsheet VisiCalc data (*.dif)
  • Data Interchange Formats: This includes the JSON format
  • Database Formats: This includes MS Access (*.mdb) and dBase (*.dbf)
  • Compression and Archive Formats: This includes the files created by archivers, such as Windows ZIP (*.zip), Unix GZIP (*.gz), Unix TAR (*.tar), and BZIP2 (*.bz2)
  • XML/HTML Formats: This includes extensions such as .xml, .xhtml, .html, and .rss

Note

Here, you may find the complete list of all the data formats...

Importing data in Mathematica

In order to import data into Mathematica, the Import function is used. Let's see how this feature is used in practice.

If you need to simply import the file, you can do it as follows:

Import["file_name"]

However, in practice, it is much more useful to use additional parameters of this function. Let's consider the following example.

Let's suppose we need to import the data on unemployment. We will take the information from the http://unstats.un.org/unsd/mbs/app/DataSearchTable.aspx page in the Topic list, select EMPLOYMENT, UNEMPLOYMENT AND EARNINGS and in the Table list select 11 Unemployment. Then, select all the countries with the Shift button. After that download data by clicking on the Get data button and then clicking on the Download in CSV button, and save it into the C:\MathData\Unemployment.csv file.

In order to import data, let's select the Import function:

Importing data in Mathematica

Note

Note that in Mathematica, \ is a special character. This is why...

Additional cleaning functions and data conversion

Let's examine additional parameters of the functions that can help when importing data. Sometimes the data can be littered or have a wrong format—for example, instead of numeric, there may appear text data or it can be missing completely.

You can control the format of the incoming data with the help of templates that are used in the Case function. For example, if you need only numeric data to be imported, then the template will look like this: x_?NumericQ.

Note

All information about data types used in Mathematica can be found at http://reference.wolfram.com/language/tutorial/PuttingConstraintsOnPatterns.html.

Let's take a wider range of data for the analysis on unemployment in a country (country, date, and unemployment rate):

Additional cleaning functions and data conversion

When you import data, it is important to check the format of the input data—for example, the number 2.3 can be identified as the string "2.3", and as a result, we are no longer able to work...

Importing strings

In particular, we should examine the ImportString function that allows you to import data from a certain format string. The following examples can help us trace function result changes depending on the type of input data.

Importing strings

Note

More information on valid formats for data import can be obtained by querying $ImportFormats in Mathematica.

Importing data from Mathematica's notebooks

In Mathematica, it is very convenient to transfer the formulas that you have used in other notebooks. This is done using the ImportNotebook function.

For example, let's create a new document using the CreateDocument function:

Importing data from Mathematica's notebooks

We have created a document in which there are only two cells to calculate—the root of 16 and the root of -6. This is a test example to demonstrate the function's capabilities. As a result, we get the following notebook:

Importing data from Mathematica's notebooks

Let's consider import options with the help of the NotebookImport function. In order to import all the notebook's parameters, just call NotebookImport with the "_" parameter:

Importing data from Mathematica's notebooks

In order to convert the values to text, you can use the _->"Text" rule:

Note

Arrows and double square brackets are input with the help of the following combination of keys: Esc - >Esc.

Importing data from Mathematica's notebooks

Let's use the "Input" parameter to get a list of cells with input data:

Importing data from Mathematica's notebooks

To import only...

Permissible data format for import


Mathematica allows the importing of hundreds of data formats, but we only need some of them: those that are amenable to mathematical processing and analysis.

The main data formats can be divided into the following groups:

  • Tabular Text Formats: This includes general text format data (*.dat), comma-separated (*.csv), or tab-separated (*.tsv)

  • Spreadsheet Formats: This includes office programs data working with documents, such as Excel (*.xls and *.xlsx), Open Office (*.odc, and *.sxc), and even the first spreadsheet VisiCalc data (*.di f)

  • Data Interchange Formats: This includes the JSON format

  • Database Formats: This includes MS Access (*.mdb) and dBase (*.dbf)

  • Compression and Archive Formats: This includes the files created by archivers, such as Windows ZIP (*.zip), Unix GZIP (*.gz), Unix TAR (*.tar), and BZIP2 (*.bz2)

  • XML/HTML Formats: This includes extensions such as .xml, .xhtml, .html, and .rss

Note

Here, you may find the complete list of all the data formats...

Importing data in Mathematica


In order to import data into Mathematica, the Import function is used. Let's see how this feature is used in practice.

If you need to simply import the file, you can do it as follows:

Import["file_name"]

However, in practice, it is much more useful to use additional parameters of this function. Let's consider the following example.

Let's suppose we need to import the data on unemployment. We will take the information from the http://unstats.un.org/unsd/mbs/app/DataSearchTable.aspx page in the Topic list, select EMPLOYMENT, UNEMPLOYMENT AND EARNINGS and in the Table list select 11 Unemployment. Then, select all the countries with the Shift button. After that download data by clicking on the Get data button and then clicking on the Download in CSV button, and save it into the C:\MathData\Unemployment.csv file.

In order to import data, let's select the Import function:

Note

Note that in Mathematica, \ is a special character. This is why in order to specify the path correctly...

Left arrow icon Right arrow icon

Key benefits

  • Use the power of Mathematica to analyze data in your applications
  • Discover the capabilities of data classification and pattern recognition offered by Mathematica
  • Use hundreds of algorithms for time series analysis to predict the future

Description

There are many algorithms for data analysis and it’s not always possible to quickly choose the best one for each case. Implementation of the algorithms takes a lot of time. With the help of Mathematica, you can quickly get a result from the use of a particular method, because this system contains almost all the known algorithms for data analysis. If you are not a programmer but you need to analyze data, this book will show you the capabilities of Mathematica when just few strings of intelligible code help to solve huge tasks from statistical issues to pattern recognition. If you're a programmer, with the help of this book, you will learn how to use the library of algorithms implemented in Mathematica in your programs, as well as how to write algorithm testing procedure. With each chapter, you'll be more immersed in the special world of Mathematica. Along with intuitive queries for data processing, we will highlight the nuances and features of this system, allowing you to build effective analysis systems. With the help of this book, you will learn how to optimize the computations by combining your libraries with the Mathematica kernel.

Who is this book for?

The book is for those who want to learn to use the power of Mathematica to analyze and process data. Perhaps you are already familiar with data analysis but have never used Mathematica, or you know Mathematica but you are new to data analysis. With the help of this book, you will be able to quickly catch up on the key points for a successful start.

What you will learn

  • Import data from different sources to Mathematica
  • Link external libraries with programs written in Mathematica
  • Classify data and partition them into clusters
  • Recognize faces, objects, text, and barcodes
  • Use Mathematica functions for time series analysis
  • Use algorithms for statistical data processing
  • Predict the result based on the observations

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 24, 2015
Length: 164 pages
Edition : 1st
Language : English
ISBN-13 : 9781785884450
Category :
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 : Dec 24, 2015
Length: 164 pages
Edition : 1st
Language : English
ISBN-13 : 9781785884450
Category :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.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
$199.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
$279.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 $ 132.97
OpenCV with Python By Example
$54.99
Mathematica Data Analysis
$38.99
Mathematica data visualization
$38.99
Total $ 132.97 Stars icon

Table of Contents

9 Chapters
1. First Steps in Data Analysis Chevron down icon Chevron up icon
2. Broad Capabilities for Data Import Chevron down icon Chevron up icon
3. Creating an Interface for an External Program Chevron down icon Chevron up icon
4. Analyzing Data with the Help of Mathematica Chevron down icon Chevron up icon
5. Discovering the Advanced Capabilities of Time Series Chevron down icon Chevron up icon
6. Statistical Hypothesis Testing in Two Clicks Chevron down icon Chevron up icon
7. Predicting the Dataset Behavior Chevron down icon Chevron up icon
8. Rock-Paper-Scissors – Intelligent Processing of Datasets Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
SeVlad Mar 04, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Very helpful book with interesting examples.For novice in Mathematica.
Amazon Verified review Amazon
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.