Report not found

There was a problem finding this report.
NYC Taxis - Trip Origins
June 24, 2014 · Refreshed about 4 years ago
Description
Shows the median number of dropoffs per 1000 people by Census tract. Census tracts are grouped by the size of their non-white population. Only includes tracts in Manhattan with populations of at least 1,000 people. Only includes trips between June 17 and 23, 2013.

Collaborators

Run History
WITH trips AS ( SELECT taxi.hack_license, taxi.pickup_datetime, taxi.pickup_latitude, taxi.pickup_longitude, taxi.dropoff_datetime, taxi.dropoff_latitude, taxi.dropoff_longitude, taxi.trip_number, (people_drop.population - people_drop.white)/people_drop.population AS non_white_percent FROM benn.nyc_taxi_data_june_week taxi JOIN benn.tract_lookup tract_drop ON tract_drop.lat = ROUND(taxi.dropoff_latitude*1000)/1000 AND tract_drop.long = ROUND(taxi.dropoff_longitude*1000)/1000 AND tract_drop.county = 'New York' JOIN benn.tract_lookup tract_pick ON tract_pick.lat = ROUND(taxi.pickup_latitude*1000)/1000 AND tract_pick.long = ROUND(taxi.pickup_longitude*1000)/1000 AND tract_pick.county = 'New York' JOIN benn.nyc_census_tract_people people_drop ON people_drop.county = tract_drop.county AND people_drop.tract_number = tract_drop.tract_code AND people_drop.population >= 1000 JOIN benn.nyc_census_tract_people people_pick ON people_pick.county = tract_pick.county AND people_pick.tract_number = tract_pick.tract_code AND people_pick.population >= 1000 ) SELECT ROUND(drop.non_white_percent*20)/20 AS drop_pct, COUNT(CASE WHEN pick.non_white_percent >= .65 THEN pick.non_white_percent ELSE NULL END) AS pickups_from_non_white_tracts, COUNT(CASE WHEN pick.non_white_percent < .65 AND pick.non_white_percent >= .15 THEN pick.non_white_percent ELSE NULL END) AS pickups_from_mixed_tracts, COUNT(CASE WHEN pick.non_white_percent < .15 THEN pick.non_white_percent ELSE NULL END) AS pickups_from_white_tracts FROM trips pick JOIN trips drop ON pick.hack_license = drop.hack_license AND pick.trip_number = drop.trip_number + 1 GROUP BY 1 ORDER BY 1
WITH trips AS ( SELECT taxi.hack_license, taxi.pickup_datetime, taxi.pickup_latitude, taxi.pickup_longitude, taxi.dropoff_datetime, taxi.dropoff_latitude, taxi.dropoff_longitude, taxi.trip_number, (people_drop.population - people_drop.white)/people_drop.population AS non_white_percent FROM benn.nyc_taxi_data_june_week taxi JOIN benn.tract_lookup tract_drop ON tract_drop.lat = ROUND(taxi.dropoff_latitude*1000)/1000 AND tract_drop.long = ROUND(taxi.dropoff_longitude*1000)/1000 AND tract_drop.county = 'New York' JOIN benn.tract_lookup tract_pick ON tract_pick.lat = ROUND(taxi.pickup_latitude*1000)/1000 AND tract_pick.long = ROUND(taxi.pickup_longitude*1000)/1000 AND tract_pick.county = 'New York' JOIN benn.nyc_census_tract_people people_drop ON people_drop.county = tract_drop.county AND people_drop.tract_number = tract_drop.tract_code AND people_drop.population >= 1000 JOIN benn.nyc_census_tract_people people_pick ON people_pick.county = tract_pick.county AND people_pick.tract_number = tract_pick.tract_code AND people_pick.population >= 1000 ) SELECT ROUND(drop.non_white_percent*20)/20 AS drop_pct, COUNT(CASE WHEN pick.non_white_percent >= .65 THEN pick.non_white_percent ELSE NULL END) AS pickups_from_non_white_tracts, COUNT(CASE WHEN pick.non_white_percent < .65 AND pick.non_white_percent >= .15 THEN pick.non_white_percent ELSE NULL END) AS pickups_from_mixed_tracts, COUNT(CASE WHEN pick.non_white_percent < .15 THEN pick.non_white_percent ELSE NULL END) AS pickups_from_white_tracts FROM trips pick JOIN trips drop ON pick.hack_license = drop.hack_license AND pick.trip_number = drop.trip_number + 1 GROUP BY 1 ORDER BY 1
<style> .bar1 { fill: #B1D2D2; } .bar2 { fill: #ef9c69; } .bar3 { fill: #3c8e8e;; } .axis { font: 12px sans-serif; } .title { font: 16px sans-serif; } .axis path, .axis line { fill: none; stroke: #000; shape-rendering: crispEdges; } .x.axis path { display: none; } </style> <body> <div id="chart"></div> <script> draw(); $(window).on("resize",function() { draw() }) function draw() { d3.select("svg").remove(); var margin = {top: 50, right: 20, bottom: 50, left: 40}, width = $(document).width() - margin.left - margin.right, height = 330 - margin.top - margin.bottom; var p = d3.format("%") var x = d3.scale.ordinal() .rangeRoundBands([0, width], .1); var y = d3.scale.linear() .range([height, 0]); var xAxis = d3.svg.axis() .scale(x) .tickFormat(formatX) .orient("bottom"); var yAxis = d3.svg.axis() .scale(y) .orient("left") .ticks(6) .tickFormat(p); function formatX(d,i) { if (i%2 == 0) { return d; } else { return ""; } } var svg = d3.select("#chart").append("svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); data = dataset.content; var y1Sum = 0, y2Sum = 0, y3Sum = 0; data.forEach(function(d) { y1Sum += d.pickups_from_white_tracts; y2Sum += d.pickups_from_mixed_tracts; y3Sum += d.pickups_from_non_white_tracts; }) var y1Max = d3.max(data,function(d) { return d.pickups_from_white_tracts; }), y2Max = d3.max(data,function(d) { return d.pickups_from_mixed_tracts; }); y3Max = d3.max(data,function(d) { return d.pickups_from_non_white_tracts; }), x.domain(data.map(function(d) { return p(d.drop_pct); })); y.domain([0,Math.max(y1Max/y1Sum,y2Max/y2Sum,y3Max/y3Sum)]) svg.append("text") .attr("x",(width+margin.left+margin.right)/2 - margin.left) .attr("y",-20) .attr("text-anchor","middle") .attr("class","title") .text("Distribution of Pickups by Demographics of Previous Dropoff Points") svg.append("g") .attr("class", "x axis") .attr("transform", "translate(0," + height + ")") .call(xAxis) .append("text") .attr("transform", "translate(" + width/2 + ",30)") .attr("dy", ".71em") .style("text-anchor", "middle") .text("Percent of previous dropoff tract that is non-white"); svg.append("g") .attr("class", "y axis axis-left") .call(yAxis) bars = svg.selectAll(".bar").data(data).enter(); bars.append("rect") .attr("class", "bar1") .attr("x", function(d) { return x(p(d.drop_pct)); }) .attr("width", x.rangeBand()/3) .attr("y", function(d) { return y(d.pickups_from_white_tracts/y1Sum); }) .attr("height", function(d) { return height - y(d.pickups_from_white_tracts/y1Sum); }); bars.append("rect") .attr("class", "bar2") .attr("x", function(d) { return x(p(d.drop_pct)) + x.rangeBand()/3; ; }) .attr("width", x.rangeBand()/3) .attr("y", function(d) { return y(d.pickups_from_mixed_tracts/y2Sum); }) .attr("height", function(d) { return height - y(d.pickups_from_mixed_tracts/y2Sum); }); bars.append("rect") .attr("class", "bar3") .attr("x", function(d) { return x(p(d.drop_pct)) + (2*x.rangeBand())/3; ; }) .attr("width", x.rangeBand()/3) .attr("y", function(d) { return y(d.pickups_from_non_white_tracts/y3Sum); }) .attr("height", function(d) { return height - y(d.pickups_from_non_white_tracts/y3Sum); }); svg.append("rect") .attr("class","bar1") .attr("x",width*.5) .attr("y",10) .attr("width",20) .attr("height",20); svg.append("rect") .attr("class","bar2") .attr("x",width*.5) .attr("y",40) .attr("width",20) .attr("height",20); svg.append("rect") .attr("class","bar3") .attr("x",width*.5) .attr("y",70) .attr("width",20) .attr("height",20); svg.append("text") .attr("x", width*.5 + 25) .attr("y",20) .attr("dy", ".35em") .text("Pickups in 0-15% non-white tracts"); svg.append("text") .attr("x", width*.5 + 25) .attr("y",50) .attr("dy", ".35em") .text("Pickups in 15-65% non-white tracts"); svg.append("text") .attr("x", width*.5 + 25) .attr("y",80) .attr("dy", ".35em") .text("Pickups in 65-100% non-white tracts"); } </script>
{{ dataSourceName(params.queryId) }}

The dataset is too large to view in browser

Export

Looks like something went wrong with your query.

{{ DS.queryRuns[params.queryId].errorMessage }}
This query was cancelled