WOLFRAM NOTEBOOK

Template Notebook
Generate
ts=TimeSeriesDatabin
"BinID"
;
binDataWithTemperature=Dataset@BlockMap(Append[Last[#],"Temperature"Median[WeatherData[Last[#]["City"],"MeanTemperature",Append[#[[All,"Timestamp"]],"Day"],"NonMetricValue"]]])&,NormalDatasetDatabin
"BinID"
,2,1;

Report as of
DateString[ts[[1]]["LastDate"],"ISODate"]

Gas Mileage

WithestimatedMPG=
ts["EstimatedMPG"]
,actualMPG=
ts["TripDistance"]
ts["FuelUsed"]
,DateListPlot[{estimatedMPG,actualMPG},PlotLabels{"Computed","Actual"},PlotTheme"Detailed",FrameLabel{"","mi/gal"},Epilog{{Blue,Thin,Dashed,Tooltip[Line[{{estimatedMPG["FirstDate"],QuantityMagnitude[#]},{estimatedMPG["LastDate"],QuantityMagnitude[#]}}],#]}&[Mean[estimatedMPG]],{Darker@Orange,Thin,Dashed,Tooltip[Line[{{estimatedMPG["FirstDate"],QuantityMagnitude[#]},{estimatedMPG["LastDate"],QuantityMagnitude[#]}}],#]}&[Mean[actualMPG]]},PlotLabelStringTemplate["Average lifetime MPG: `mpg` mpg"][<|"mpg"QuantityMagnitude@Round[Echo@Mean[actualMPG],0.1]|>],ImageSizeLarge,MeshAll,Filling{1{2}}]

Counties

ShowGeoGraphics@EdgeForm[Black],Sequence@@Polygon/@
Illinois, United States
ADMINISTRATIVE DIVISION
,
Indiana, United States
ADMINISTRATIVE DIVISION
,
Wisconsin, United States
ADMINISTRATIVE DIVISION
,GeoHistogram
Counts[Normal[binDataWithTemperature][[All,"City"]]]
,"AdministrativeDivision2",PlotLegendsAutomatic,ImageSizeLarge

Price per gallon

DateListPlot
ts["TotalPrice"]/ts["FuelUsed"]
,PlotTheme"Detailed",FrameLabel{"","$/gal"},ImageSizeLarge,MeshAll

Odometer

Withodometer=
ts["Odometer"]
,DateListPlot[odometer,PlotTheme"Detailed",FrameLabel{"","miles"},ImageSizeLarge,MeshAll]

MPG vs Speed

WithmpgVsSpeed=
Values@Normal@Select[binDataWithTemperature[[All,{"AverageSpeed","EstimatedMPG"}]],FreeQ[_Missing]]
,ListPlot[mpgVsSpeed,PlotTheme"Detailed",FrameLabel{"mi/h","mi/gal"},PlotLabelStringTemplate[" = `r`"][<|"r"Round[Correlation@@Transpose[mpgVsSpeed],0.01]|>],ImageSizeLarge]

MPG vs Temperature

WithmpgVsTemp=
Values@Normal@binDataWithTemperature[[All,{"Temperature","EstimatedMPG"}]]
,ListPlot[mpgVsTemp,PlotTheme"Detailed",FrameLabel{"°F","mi/gal"},PlotLabelStringTemplate[" = `r`"][<|"r"Round[Correlation@@Transpose[mpgVsTemp],0.01]|>],ImageSizeLarge]

MPG vs Temperature and Speed

WithmpgVsSpeedAndTemp=
Values@Normal@Select[binDataWithTemperature[[All,{"Temperature","AverageSpeed","EstimatedMPG"}]],FreeQ[_Missing]]
,ListPointPlot3D[mpgVsSpeedAndTemp,PlotStylePointSize[Large],AxesLabel{"Temp","Speed","MPG"},FillingAxis,PlotTheme"Detailed",PlotRange{All,All,{15,40}}]
Wolfram Cloud

You are using a browser not supported by the Wolfram Cloud

Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.


I understand and wish to continue anyway »

You are using a browser not supported by the Wolfram Cloud. Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.