This summarizes the data table using Datalib.
This data is from Data.gov: Consumer Complaint Database.
The data set has data about complaints sent to the Consumer Financial Protection Bureau about financial services. This data set was too big for the constraints of the assignment so it had to be modified. This set only includes January, Feburary and March of 2017 and does not have the narratives that consumer put with the complaint. The attributes in this data include the product, subproduct, issue and subissue of the complaint as well as company the complaint is about and the kind of response the company gave.
forked from curran's block: Data Table Summary
forked from emilyw15's block: CFPB Data Table Summary
forked from curran's block: Aggregation with Datalib
xxxxxxxxxx
<html>
<head>
<meta charset="utf-8">
<title>Data Summary</title>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://unpkg.com/datalib@1.8.0/datalib.min.js"></script>
<style>
</style>
</head>
<body>
<script>
// Use these for other formats:
// d3.tsv('data.tsv', data => {
// d3.json('data.json', data => {
// Load and summarize the data.
d3.csv('CCDC-November-NoPrivateData.csv', data => {
// Aggregate over selected attributes by counting.
data = dl
.groupby([
'Source',
'Status'
//'Timely response?',
//'Consumer disputed?'
])
.count()
.execute(data);
//console.log(data)
// Assemble a summary string.
const summary = [
'Data table summary: ',
data.length + ' rows',
//data.columns.length + ' columns',
Math.round(d3.csvFormat(data).length / 1024) + ' kB',
'\nSummary of each column:',
dl.format.summary(data)
].join('\n');
// Show the summary string on the page.
d3.select('body').append('pre').text(summary);
// Log the summary to the console.
console.log(summary);
});
</script>
</body>
</html>
https://d3js.org/d3.v4.min.js
https://unpkg.com/datalib@1.8.0/datalib.min.js