Calculating statistics
Danfo.js comes with some important statistical and mathematical functions. These functions can be used to generate a summary or descriptive statistics of entire DataFrames, as well as a single Series. In datasets, statistics are important because they can give us better insights into data.
In the following sections, we'll use the popular Titanic dataset, which you can download from the following GitHub repository: https://github.com/PacktPublishing/Building-Data-Driven-Applications-with-Danfo.js/blob/main/Chapter03/data/titanic.csv.
First, let's load the dataset into Dnotebook using the read_csv
function, as shown in the following code:
var df //using var so df is available to all cells load_csv("https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv") .then((data)=>{ df = data })
The preceding code loads the Titanic dataset from the specified URL and persists it in the df
variable.