Building Data-Driven Applications with Danfo.js

Book description

Get hands-on with building data-driven applications using Danfo.js in combination with other data analysis tools and techniques

Key Features

  • Build microservices to perform data transformation and ML model serving in JavaScript
  • Explore what Danfo.js is and how it helps with data analysis and data visualization
  • Combine Danfo.js and TensorFlow.js for machine learning

Book Description

Most data analysts use Python and pandas for data processing for the convenience and performance these libraries provide. However, JavaScript developers have always wanted to use machine learning in the browser as well. This book focuses on how Danfo.js brings data processing, analysis, and ML tools to JavaScript developers and how to make the most of this library to build data-driven applications.

Starting with an overview of modern JavaScript, you'll cover data analysis and transformation with Danfo.js and Dnotebook. The book then shows you how to load different datasets, combine and analyze them by performing operations such as handling missing values and string manipulations. You'll also get to grips with data plotting, visualization, aggregation, and group operations by combining Danfo.js with Plotly. As you advance, you'll create a no-code data analysis and handling system and create-react-app, react-table, react-chart, Draggable.js, and tailwindcss, and understand how to use TensorFlow.js and Danfo.js to build a recommendation system. Finally, you'll build a Twitter analytics dashboard powered by Danfo.js, Next.js, node-nlp, and Twit.js.

By the end of this app development book, you'll be able to build and embed data analytics, visualization, and ML capabilities into any JavaScript app in server-side Node.js or the browser.

What you will learn

  • Perform data experimentation and analysis with Danfo.js and Dnotebook
  • Build machine learning applications using Danfo.js integrated with TensorFlow.js
  • Connect Danfo.js with popular database applications to aid data analysis
  • Create a no-code data analysis and handling system using internal libraries
  • Develop a recommendation system with Danfo.js and TensorFlow.js
  • Build a Twitter analytics dashboard for sentiment analysis and other types of data insights

Who this book is for

This book is for data analysts, data scientists, and JavaScript developers who want to create data-driven applications in the JavaScript/Node.js environment. Intermediate-level knowledge of JavaScript programming and data science using pandas is expected.

Table of contents

  1. Building Data-Driven Applications with Danfo.js
  2. Contributors
  3. About the authors
  4. About the reviewers
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Share Your Thoughts
  6. Section 1: The Basics
  7. Chapter 1: An Overview of Modern JavaScript
    1. Technical requirements
    2. Understanding the difference between let and var
      1. var allows the redeclaration of variables
      2. var is not a blocked scope
    3. Destructuring
    4. Spread syntax
      1. Spreading or unpacking an iterable into an array
      2. Creating new objects from existing ones
      3. Function arguments
    5. Overview of scopes and closures
      1. Scope
      2. Closure
    6. Understanding Array and Object methods
      1. Array methods
      2. Objects
    7. Understanding the this property
    8. Arrow functions
    9. Promises and async/await
      1. Cleaning callbacks with promises
      2. async/await
    10. Object-oriented programming and JavaScript classes
      1. Classes
      2. Inheritance
    11. Setting up a modern JavaScript environment with transpilers
      1. Babel
      2. Webpack
    12. Unit testing with Mocha and Chai
      1. Setting up a test environment
    13. Summary
  8. Section 2: Data Analysis and Manipulation with Danfo.js and Dnotebook
  9. Chapter 2: Dnotebook - An Interactive Computing Environment for JavaScript
    1. Technical requirements
    2. Introduction to Dnotebook
    3. Setup and installation of Dnotebook
    4. Basic concepts behind interactive computing in Dnotebook
      1. Cells
      2. Code cells
      3. Markdown cells
      4. Persistence/state
    5. Writing interactive code
      1. Loading external packages
      2. Loading CSV files
      3. Getting a div container for plots
      4. Gotchas when using a for loop
    6. Working with Markdown cells
      1. Creating a Markdown cell
      2. Adding images
      3. Headings
      4. Lists
    7. Saving notebooks
    8. Summary
  10. Chapter 3: Getting Started with Danfo.js
    1. Technical requirements
    2. Why you need Danfo.js
    3. Installing Danfo.js
    4. Introducing Series and DataFrames
      1. Series
      2. DataFrames
    5. Essential functions and methods in Danfo.js
      1. loc and iloc indexing
      2. Sorting
      3. Filtering
      4. Arithmetic operations
      5. Logical operations
    6. Data loading and working with different file formats
      1. Transforming a DataFrame into another file format
    7. Summary
  11. Chapter 4: Data Analysis, Wrangling, and Transformation
    1. Technical requirements
    2. Transforming data
      1. Replacing missing values
      2. Removing duplicates
      3. Data transformation with the map function
      4. Data transformation with the apply function
      5. Filtering and querying
      6. Random sampling
      7. Encoding DataFrames and Series
    3. Combining datasets
      1. DataFrame merge
      2. Data concatenation
    4. Series data accessors
    5. Calculating statistics
      1. Calculating statistics by axis
    6. Summary
  12. Chapter 5: Data Visualization with Plotly.js
    1. Technical requirements
    2. A brief primer on Plotly.js
      1. Using Plotly.js via a script tag
    3. Fundamentals of Plotly.js
      1. Data format
      2. Configuration options for plots
      3. Plotly layout
    4. Creating basic charts with Plotly.js
    5. Creating statistical charts with Plotly.js
      1. Creating histogram plots with Plotly.js
      2. Creating box plots with Plotly.js
      3. Creating violin plots with Plotly.js
    6. Summary
  13. Chapter 6: Data Visualization with Danfo.js
    1. Technical requirements
    2. Setting up Danfo.js for plotting
      1. Adding Danfo.js to your code
      2. Downloading a dataset for plotting
    3. Creating line charts with Danfo.js
    4. Creating scatter plots with Danfo.js
    5. Creating box and violin plots with Danfo.js
      1. Making box and violin plots for a Series
      2. Box and violin plots for multiple columns
      3. Box and violin plots with specific x and y values
    6. Creating histograms with Danfo.js
      1. Creating a histogram from a Series
      2. Creating a histogram from multiple columns
    7. Creating bar charts with Danfo.js
      1. Creating a bar chart from a Series
      2. Creating a bar chart from multiple columns
    8. Summary
  14. Chapter 7: Data Aggregation and Group Operations
    1. Technical requirements
    2. Grouping data
      1. Single-column grouping
      2. Double-column grouping
    3. Iterating through grouped data
      1. Iterating through single- and double-column grouped data
    4. Using the .apply method
    5. Data aggregation of grouped data
      1. Data aggregation on single-column grouping
      2. Data aggregation on double-column grouping
      3. A simple application of groupby on real data
    6. Summary
  15. Section 3: Building Data-Driven Applications
  16. Chapter 8: Creating a No-Code Data Analysis/Handling System
    1. Technical requirements
    2. Setting up the project environment
    3. Structuring and designing the app
    4. App layout and the DataTable component
      1. Implementing DataTable components
      2. File upload and state management
    5. Creating different DataFrame operation components
      1. Implementing the Describe component
      2. Implementing the Query component
      3. Implementing the Df2df component
      4. Implementing the Arithmetic component
    6. Implementing the chart component
      1. Implementing the ChartPlane component
      2. Implementing the ChartViz component
      3. Integrating ChartViz and ChartPlane into App.js
    7. Summary
  17. Chapter 9: Basics of Machine Learning
    1. Technical requirements
    2. Introduction to machine learning
      1. A simple analogy of a machine learning system
    3. Why machine learning works
      1. Objective functions
      2. Evaluation metrics
    4. Machine learning problems/tasks
      1. Supervised learning
      2. Unsupervised learning
    5. Machine learning in JavaScript
    6. Applications of machine learning
    7. Resources to understand machine learning in depth
    8. Summary
  18. Chapter 10: Introduction to TensorFlow.js
    1. Technical requirements
    2. What is TensorFlow.js?
    3. Installing and using TensorFlow.js
      1. Setting up TensorFlow.js in the browser
      2. Installing TensorFlow.js in Node.js
    4. Tensors and basic operations on tensors
      1. Creating tensors
      2. Operating on tensors
    5. Building a simple regression model with TensorFlow.js
      1. Setting up your environment locally
      2. Retrieving and processing the training dataset
      3. Creating models with TensorFlow.js
      4. Creating a simple three-layer regression model
      5. Training the model with the processed dataset
      6. Making predictions with the trained model
    6. Summary
  19. Chapter 11: Building a Recommendation System with Danfo.js and TensorFlow.js
    1. Technical requirements
    2. What is a recommendation system?
      1. Collaborative filtering approach
      2. Hybrid filtering approach
    3. The neural network approach to creating a recommendation system
    4. Building a movie recommendation system
      1. Setting up your project directory
      2. Retrieving and processing the training dataset
      3. Building the recommendation model
      4. Training and saving the recommendation model
      5. Making movie recommendations with the saved model
    5. Summary
  20. Chapter 12: Building a Twitter Analysis Dashboard
    1. Technical requirements
    2. Setting up the project environment
    3. Building the backend
      1. Building the Twitter API
      2. Building the text sentiment API
    4. Building the frontend
      1. Creating the Search component
      2. Creating the ValueCounts component
      3. Creating a plot component for sentiment analysis
      4. Creating a Table component
    5. Summary
  21. Chapter 13: Appendix: Essential JavaScript Concepts
    1. Technical requirements
    2. Quick overview of JavaScript
    3. Understanding the fundamentals of JavaScript
      1. Declaring variables
      2. Data types
      3. Conditional branching and loops
      4. JavaScript functions
    4. Summary
    5. Why subscribe?
  22. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share Your Thoughts

Product information

  • Title: Building Data-Driven Applications with Danfo.js
  • Author(s): Rising Odegua, Stephen Oni
  • Release date: September 2021
  • Publisher(s): Packt Publishing
  • ISBN: 9781801070850