EDIT: I am wrong. The callback is per row. However, the data are indeed loaded asynchronously in the newest version of d3. I had some trouble finding the right way to use this function, but I found the solution. d3.csv now returns a promise. To use the parsed data, pass doSomething to the promise.then().

Original comment, for context:

The CSV file is loaded asynchronously, so setting data=d3.csv(path,callback) makes little sense. When you declare a callback, that is where things must happen. The callback may refer to a global variable, or just use a local variable and pass the result to the next stage. Judging by your code, you want to output an object that holds filtered/postprocessed columns stored under their respective keys.

Also, I doubt that the time parse method can be applied to an array. To do that, you likely have to use

I would suggest something like this (not tested):

var parseDate = d3.time.format("%m/%d/%Y %H:%M:%S %p").parse;
d3.csv("Sales Export Friendly 3-19-17.csv", function(data) {
    //Note that data is a local in this function scope
    let filtered_data = {
        unit: data["Unit Booked"],
        date: data["Booking Date"].map(s=>parseDate().getMonth()+1),
        checkin: data["Checkin"].map(s=>parseDate().getMonth()+1),
        total: data["Total Stay"].map(s=>+s),

    filtered_data.LOS = [];
    filtered_data.avgNight = [];
    let N = data["Checkout"].length;
    for (let i=0; i < N; i++) {
        filtered_data.LOS[i] = parseDate(data["Checkout"][i]).valueOf() -parseDate(data["Checkin"][i]).valueOf()/(24*60*60*1000),
        filtered_data.avgNight[i] = (+data["Total Stay"][i])/filtered_data.LOS[i];

More Query from same tag