temp = 212.0
def toCelsius(fahrenheit):
return (fahrenheit - 32) * 5.0 / 9.0
print toCelsius(temp)
100.0
import pandas as pd
from pandas.io import gbq
print "Imports run."
Imports run.
projectId = "cloud-training-demos" # CHANGEME
sql = """
SELECT
year,
AVG(weight_pounds) AS avg_weight
FROM
publicdata.samples.natality
GROUP BY
year
ORDER BY
year ASC
"""
print 'Running query...'
data = gbq.read_gbq(sql, project_id=projectId)
data[:5]
Running query... Requesting query... ok. Query running... Query done. Cache hit. Retrieving results... Got 40 rows. Total time taken 1.2 s. Finished at 2017-03-24 19:46:14.
year | avg_weight | |
---|---|---|
0 | 1969 | 7.203189 |
1 | 1970 | 7.222404 |
2 | 1971 | 7.245800 |
3 | 1972 | 7.254677 |
4 | 1973 | 7.266844 |
data.plot(x='year', y='avg_weight');