If I put the following code within a single Observable HQ cell, I get
data5 = TypeError: reading.map is not a function
data5 = {
const reading = FileAttachment("climate_graphs - china.csv").csv();
reading.map(function(element) {
return {"date": element["date"], "value": element["value"]}
})
}
However, if I break it up into 2 cells, it works:
// cell 1
reading = FileAttachment("climate_graphs - china.csv").csv();
// cell 2
data = reading.map(function(element) {
return {"date": element["date"], "value": element["value"]}
})