Book Image

Practical Data Analysis - Second Edition

By : Hector Cuesta, Dr. Sampath Kumar
Book Image

Practical Data Analysis - Second Edition

By: Hector Cuesta, Dr. Sampath Kumar

Overview of this book

Beyond buzzwords like Big Data or Data Science, there are a great opportunities to innovate in many businesses using data analysis to get data-driven products. Data analysis involves asking many questions about data in order to discover insights and generate value for a product or a service. This book explains the basic data algorithms without the theoretical jargon, and you’ll get hands-on turning data into insights using machine learning techniques. We will perform data-driven innovation processing for several types of data such as text, Images, social network graphs, documents, and time series, showing you how to implement large data processing with MongoDB and Apache Spark.
Table of Contents (21 chapters)
Practical Data Analysis - Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface

Implementation in D3js


In this chapter, we will create an animation in D3.js of a Brownian motion Random Walk simulation. In the simulation, we will control the delay of the animation, the starting point of the Random Walk, and the tendency of the up-down factor.

First, we need to create an HTML file named Simulation.html, and we will run it from Python http.server. In order to run the animation, we just need to open a Command Terminal and run the following command:

>>python -m http.server 8000

Open a web browser and type the direction http://localhost:8000 and select our HTML file; then, we can see the animation running.

First, we need to import the D3 library either directly from the website or with a local copy of the d3.v3.min.js file:

<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script> 

In the CSS, we specified the style for the axis line, the font family and size for the text, and the background color:

<style type="text/css"> 
body...