Reader small image

You're reading from  Hands-On Data Science with Anaconda

Product typeBook
Published inMay 2018
Reading LevelIntermediate
PublisherPackt
ISBN-139781788831192
Edition1st Edition
Languages
Concepts
Right arrow
Authors (2):
Yuxing Yan
Yuxing Yan
author image
Yuxing Yan

Yuxing Yan graduated from McGill University with a PhD in finance. Over the years, he has been teaching various finance courses at eight universities: McGill University and Wilfrid Laurier University (in Canada), Nanyang Technological University (in Singapore), Loyola University of Maryland, UMUC, Hofstra University, University at Buffalo, and Canisius College (in the US). His research and teaching areas include: market microstructure, open-source finance and financial data analytics. He has 22 publications including papers published in the Journal of Accounting and Finance, Journal of Banking and Finance, Journal of Empirical Finance, Real Estate Review, Pacific Basin Finance Journal, Applied Financial Economics, and Annals of Operations Research. He is good at several computer languages, such as SAS, R, Python, Matlab, and C. His four books are related to applying two pieces of open-source software to finance: Python for Finance (2014), Python for Finance (2nd ed., expected 2017), Python for Finance (Chinese version, expected 2017), and Financial Modeling Using R (2016). In addition, he is an expert on data, especially on financial databases. From 2003 to 2010, he worked at Wharton School as a consultant, helping researchers with their programs and data issues. In 2007, he published a book titled Financial Databases (with S.W. Zhu). This book is written in Chinese. Currently, he is writing a new book called Financial Modeling Using Excel — in an R-Assisted Learning Environment. The phrase "R-Assisted" distinguishes it from other similar books related to Excel and financial modeling. New features include using a huge amount of public data related to economics, finance, and accounting; an efficient way to retrieve data: 3 seconds for each time series; a free financial calculator, showing 50 financial formulas instantly, 300 websites, 100 YouTube videos, 80 references, paperless for homework, midterms, and final exams; easy to extend for instructors; and especially, no need to learn R.
Read more about Yuxing Yan

James Yan
James Yan
author image
James Yan

James Yan is an undergraduate student at the University of Toronto (UofT), currently double-majoring in computer science and statistics. He has hands-on knowledge of Python, R, Java, MATLAB, and SQL. During his study at UofT, he has taken many related courses, such as Methods of Data Analysis I and II, Methods of Applied Statistics, Introduction to Databases, Introduction to Artificial Intelligence, and Numerical Methods, including a capstone course on AI in clinical medicine.
Read more about James Yan

View More author details
Right arrow

Introduction

Nowadays, we are overwhelmed by large amounts of information—see Shi, Zhang, and Khan (2017), or Fang and Zhang (2016)—the catchphrase being big data. However, defining it is still controversial, since many explanations are available. Davenport and Patil (2012) suggest that if your organization stores multiple petabytes of data, if the information most critical to your business resides in forms other than rows and columns of numbers, or if answering your biggest question would involve a mashup of several analytical efforts, you've got a big data opportunity.

Many users of data science or data analytics are learning several programming languages such as R and Python, but how can they use both of them at the same time? If John is using R while his teammate is using Python, how do they communicate with each other? How do team members share their packages, programs, and even their working environments? In this book, we try our best to offer a solution to all of these challenging tasks by introducing Anaconda, since it possesses several wonderful properties.

Generally speaking, R is a programming language for statistical computing and graphics that is supported by the R Foundation for statistical computing. Python is an interpreted, object-oriented programming language similar to Perl that has gained popularity because of its clear syntax and readability. Julia is for numerical computing and extensive mathematical function and is designed for parallelism and cloud computing, while Octave is for numerical computation and mathematics-oriented and batch-oriented language. All those four languages, R, Python, Julia, and Octave, are free.

Reasons for using Jupyter via Anaconda

In data science or data analytics, we usually work in a team. This means that each developer, researcher, or team member, might have his/her favorite programming language, such as Python, R, Octave, or Julia. If we could have a platform to run all of those languages, it would be great. Fortunately, Jupyter is such a platform, since this platform can accommodate over 40 languages, including Python, R, Julia, Octave, and Scala.

In Chapter 2, Anaconda Installation, we will show you how to run those four languages via Jupyter. Of course, there are other benefits of using Anaconda: we might worry less about the dependency of installed packages, manage packages more efficiently, and share our programs, projects, and working environments. In addition, Jupyter Notebooks can be shared with others using email, Dropbox, GitHub, and the Jupyter Notebook Viewer.

Using Jupyter without pre-installation

In Chapter 2, Anaconda Installation, we will discuss how to install Jupyter via Anaconda installation. However, we could launch Jupyter occasionally without pre-installation by going to the web page at https://jupyter.org/try:

  1. The welcome screen will be presented with various options for trying out different languages.
  2. For example, by clicking the Try Jupyter with Julia image, we would see the following screen:
  1. To save space, the screenshot shows only the first part of the demo. Any readers could try the previous two steps to view the whole demo. In addition, if we click the Try Jupyter with R image, the following screen would show:
  1. After selecting Try Jupyter with Python, you will be presented with the welcome screen for the same.
  1. Next, we will show you how to execute a few simple commands in R, Python, and Julia. For example, we could use R to use the platform to run a few simple command lines. In the following example, we enter pv=100, r=0.1,and n=5:
  1. After clicking the Run button on the menu bar, we assign those values to the three variables. Then we can estimate the future value of this present value, as illustrated here:
  1. Similarly, we could try to use Python, as shown here:

In the preceding example, we import the Python package called scipy and give it a short name, sp. Although other short names could be used to represent the scipy package, it is a convention to use sp. Then, we use the sqrt() function included in the Python package.

For Julia, we could try the following code (shown in the following screenshot). Again, after going to File|New on the menu, we choose Julia 0.6.0. As of May 09, 2018, 0.6.0 is the current version for Julia. Note that your current version for Julia could be different:

In the code, we define a function called sphere_vol with just one input value of r (in radians). The answer is 64.45 for an input value of 2.5.

Previous PageNext Page
You have been reading a chapter from
Hands-On Data Science with Anaconda
Published in: May 2018Publisher: PacktISBN-13: 9781788831192
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.
undefined
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 $15.99/month. Cancel anytime

Authors (2)

author image
Yuxing Yan

Yuxing Yan graduated from McGill University with a PhD in finance. Over the years, he has been teaching various finance courses at eight universities: McGill University and Wilfrid Laurier University (in Canada), Nanyang Technological University (in Singapore), Loyola University of Maryland, UMUC, Hofstra University, University at Buffalo, and Canisius College (in the US). His research and teaching areas include: market microstructure, open-source finance and financial data analytics. He has 22 publications including papers published in the Journal of Accounting and Finance, Journal of Banking and Finance, Journal of Empirical Finance, Real Estate Review, Pacific Basin Finance Journal, Applied Financial Economics, and Annals of Operations Research. He is good at several computer languages, such as SAS, R, Python, Matlab, and C. His four books are related to applying two pieces of open-source software to finance: Python for Finance (2014), Python for Finance (2nd ed., expected 2017), Python for Finance (Chinese version, expected 2017), and Financial Modeling Using R (2016). In addition, he is an expert on data, especially on financial databases. From 2003 to 2010, he worked at Wharton School as a consultant, helping researchers with their programs and data issues. In 2007, he published a book titled Financial Databases (with S.W. Zhu). This book is written in Chinese. Currently, he is writing a new book called Financial Modeling Using Excel — in an R-Assisted Learning Environment. The phrase "R-Assisted" distinguishes it from other similar books related to Excel and financial modeling. New features include using a huge amount of public data related to economics, finance, and accounting; an efficient way to retrieve data: 3 seconds for each time series; a free financial calculator, showing 50 financial formulas instantly, 300 websites, 100 YouTube videos, 80 references, paperless for homework, midterms, and final exams; easy to extend for instructors; and especially, no need to learn R.
Read more about Yuxing Yan

author image
James Yan

James Yan is an undergraduate student at the University of Toronto (UofT), currently double-majoring in computer science and statistics. He has hands-on knowledge of Python, R, Java, MATLAB, and SQL. During his study at UofT, he has taken many related courses, such as Methods of Data Analysis I and II, Methods of Applied Statistics, Introduction to Databases, Introduction to Artificial Intelligence, and Numerical Methods, including a capstone course on AI in clinical medicine.
Read more about James Yan