I have been working on creating an FTP server with Node Red and upload CSV files to it. Thank all for helping me so far on this quest ...
One thing I am sort of curious to implement when CSV files get appended is create another CSV file that is "cleaned." For example I cant figure out how to get around not appending the first row of the dataset that is the Date and variable name as well as it appears that last row is just blank. In Excel it looks like this:
Does this flow seem silly to try for the novice that has yet to fully grasp implementing databases into data acquisition practices?
Just practicing JavaScript functions and running this in Node I am sort of stuck trying to create future function block for Node Red to clean the data.
var MultilineString = `
Date,kW
1/1/2020 0:00,16.4
1/1/2020 0:15,16.8
1/1/2020 0:30,16.8
1/1/2020 0:45,16.8
1/1/2020 1:00,16.8
1/1/2020 1:15,16.4
1/1/2020 1:30,17.6
1/1/2020 1:45,16.4
1/1/2020 2:00,16.8
1/1/2020 2:15,16.8
1/1/2020 2:30,17.2
1/1/2020 2:45,18.8
`;
var csvHeaderDate = 'Date';
var csvHeaderVar = 'kW';
var rawData = MultilineString.split(',');
cleanedCsvData = []
for(var i = 0; i < rawData.length; i++){
console.log(rawData[i] === csvHeaderDate);
console.log(rawData[i] === csvHeaderVar);
//cleanedCsvData.push(rawData[i]);
}
console.log(cleanedCsvData)
At least in my head the ideal data cleaning would be removing any blank rows as well as leaving the first row where in this case it would be Date,kW
but different dataset getting FTP'd to the server could have many columns and names.
Any continued tips greatly appreciated...