Hi! I’m doing a university paper on global warming and so I decided to use the Wolfram Language as a research tool, so I built a command that, given a city and two dates, would graph the temperature of the city between the two points of the given dates.
As additional information, I decided to include a linear regression to the graph, so I investigated how to do it (I am relatively new in this language) and I tried to do it with easy data and it came out quite well, but when using it with the data obtained with WeatherData knowing that I am using days and years instead of numbers, I did not know how to make wolfram understand this as numbers to use the LinearModelFit function.
The things I have done so far is that I have isolated the temperature and the seconds in different lists, I have removed the unit from the temperature with QuantityMagnitude, then I have used Transpose to leave in format {x1,y2},{x2,y2}…
And, it doesn’t work. I don’t know why: the syntax seems to be the same as the base model of the Documentation Centre.
So, one should use AbsoluteTime[] (and not UnixTime[]).
(When one data point per year - and not per day - is used, this becomes obvious.) The result is now more plausible …
If you want to know why your version failed, it is almost certainly the replacement of QuantityMagnitude[Missing[_]] by Nothing: this will make some of your entries either an empty list or a one-element list instead of a two-element list, so you no longer have a clean two-column matrix (which is what the error message is telling you).
Note also that when you constructed DataFinal, you put x and y backwards: time should the x, temperature the y.