Chapter 2. Analyzing Data Using F# and Deedle
In the previous chapter, we carefully picked a straightforward example that does not require too much data preprocessing and too much fiddling to find an interesting visualization to build. Life is typically not that easy, so this chapter looks at a more realistic case study. Along the way, we will add one more library to our toolbox. We will look at Deedle,1 which is a .NET library for data and time series manipulation that is great for interactive data exploration, data alignment, and handling missing values.
In this chapter, we download a number of interesting indicators about countries of the world from the World Bank, but we do so efficiently by calling the REST service directly using an XML type provider. We align multiple data sets, fill missing values, and build two visualizations looking at CO2 emissions and the correlation between GDP and life expectancy.
We’ll use the two libraries covered in the previous chapter (F# Data and XPlot)
together with Deedle. If you’re referencing the libraries using the FsLab
package as before, you’ll need the following open
declarations:
#
r
"System.Xml.Linq.dll"
#
load
"packages/FsLab/FsLab.fsx"
open
Deedle
open
FSharp.Data
open
XPlot.GoogleCharts
open
XPlot.GoogleCharts.Deedle
There are two new things here. First, we need to reference the System.Xml.Linq
library, which is required by the XML type provider. Next, we open the Deedle
namespace together with extensions that let us pass data from ...
Get Analyzing and Visualizing Data with F# now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.