Book Image

Julia Cookbook

By : Raj R Jalem, Jalem Raj Rohit
Book Image

Julia Cookbook

By: Raj R Jalem, Jalem Raj Rohit

Overview of this book

Want to handle everything that Julia can throw at you and get the most of it every day? This practical guide to programming with Julia for performing numerical computation will make you more productive and able work with data more efficiently. The book starts with the main features of Julia to help you quickly refresh your knowledge of functions, modules, and arrays. We’ll also show you how to utilize the Julia language to identify, retrieve, and transform data sets so you can perform data analysis and data manipulation. Later on, you’ll see how to optimize data science programs with parallel computing and memory allocation. You’ll get familiar with the concepts of package development and networking to solve numerical problems using the Julia platform. This book includes recipes on identifying and classifying data science problems, data modelling, data analysis, data manipulation, meta-programming, multidimensional arrays, and parallel computing. By the end of the book, you will acquire the skills to work more effectively with your data.
Table of Contents (12 chapters)


Julia is a programming language that promises both speed and support for extensive data science applications. Apart from the official documentation of the language, and the individual documentations for each package, there is no single resource that combines all of them and provides a detailed guide to carry out machine learning and data science. So, this book aims to solve the problem by being a comprehensive guide to learning data science for a Julia programmer, right from the exploratory analytics part to the visualization part.

What this book covers

Chapter 1, Extracting and Handling Data, deals with the importance of the Julia programming language for data science and its applications. It also serves as a guide to handle data in the most available formats, and shows how to crawl and scrape data from the Internet.

Chapter 2, Metaprogramming, covers the concept of metaprogramming, where a language can express its own code as a data structure of itself. For example, Lisp expresses code in the form of Lisp arrays, which are data structures in Lisp itself. Similarly, Julia can express its code as data structures.

Chapter 3, Statistics with Julia, teaches you how to perform statistics in Julia, along with the common problems of handling data arrays, distributions, estimation, and sampling techniques.

Chapter 4, Building Data Science Models, talks about various data science and statistical models. You will learn to design, customize, and apply them to various data science problems. This chapter will also teach you about model selection and the ways to learn how to build and understand robust statistical models.

Chapter 5, Working with Visualizations, teaches you how to visualize and present data, and also to analyze and the findings from the data science approach that you have taken to solve a particular problem. There are various types of visualizations to display your findings, namely the bar plot, the scatter plot, pie chart, and so on. It is very important to choose an appropriate method that can reflect your findings and work in a sensible and an aesthetically pleasing manner.

Chapter 6, Parallel Computing, talks about the concepts of parallel computing and handling a lot of data in Julia.

What you need for this book

A beginner level proficiency in the Julia programming language and experience with any programming language, preferably dynamically typed ones such as Python. The software requirements assume you have any of the following OSes: Linux, Windows, or OS X. There are no specific hardware requirements, except that you run and work all your code on a desktop, or a laptop preferably.

Who this book is for

This book is for beginner-level programmers, preferably Julia programmers who are looking to explore and learn the concepts in the domain of data science.


In this book, you will find several headings that appear frequently (Getting ready, How to do it…, How it works…, There's more…, and See also).

To give clear instructions on how to complete a recipe, we use these sections as follows:

Getting ready

This section tells you what to expect in the recipe, and describes how to set up any software or any preliminary settings required for the recipe.

How to do it…

This section contains the steps required to follow the recipe.

How it works…

This section usually consists of a detailed explanation of what happened in the previous section.

There's more…

This section consists of additional information about the recipe in order to make the reader more knowledgeable about the recipe.

See also

This section provides helpful links to other useful information for the recipe.


In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The DataFrames package is needed to deal with TSV files."

Any command-line input or output is written as follows:

query = """ CREATE TABLE Student
         Name VARCHAR(255),
         Attendance FLOAT,
         JoinDate DATE,
         Enrolments INT,
         PRIMARY KEY (ID)

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "If we check the page, we should see our Page rendered! alert logged to the console."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to and enter the name of the book in the search field. The required information will appear under the Errata section.


Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.


If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.