rainArray.push(currRow)//appends the currRow just created onto the end of the table rainArray
//there is also option to specify an index you want it to go to if you don't want it at the end
}
returnrainArray
}
//another way to do the same as above
rainfall={
letrainDF=[]
for(vari=0;i<rainAmounts.length;i++){
rainDF.push({precipitation:rainAmounts[i],date:rainDates[i]})//same as block above but you push directly
}
returnrainDF
}
md`### 1.3 Simple Zebras Methods
Say we want to add a column, its easy. Data in this new table can be manipulated, queried, sorted, and munged. This would not transform the object in place. Instead, it returns a NEW OBJECT that contains the transformation that was just performed.
`
daySeries=["Monday","Tuesday","Wednesday"]
addedCol=z.addCol("Day of the Week",daySeries,newRainfall)
//assign to new df so that the transformation is actually stored and accessible
newRainfall
//note that newRainfall was not modified by the column addition above
z.addCol("day",daySeries,rainfall)//day names the unnamed 3rd column