xxxxxxxxxx
34
// Given the CSV file "mammals.csv"
// in the project's "assets" folder:
//
// id,species,name
// 0,Capra hircus,Goat
// 1,Panthera pardus,Leopard
// 2,Equus zebra,Zebra
let femaleTable;
function getFemaleLifeExpectancy(age){
print("hello")
return (femaleTable.getColumn("Life expectancy")[age]);
}
function preload() {
//my table is comma separated value "csv"
//and has a header specifying the columns labels
femaleTable = loadTable('life expectancy female.csv', 'csv', 'header');
}
function setup() {
let row = femaleTable.getRow(1);
//print it column by column
//note: a row is an object, not an array
print("hi?")
print(getFemaleLifeExpectancy(12))
}