app.py
def precipitation():
    """Return prcp data for previous year"""
    # Design a query to retrieve the last 12 months of precipitation data and plot the results
    # Calculate the date 1 year ago from the last data point in the database
    # Perform a query to retrieve the data and precipitation scores
    precipitation_data = session.query(func.strftime("%Y-%m-%d", Measurement.date), Measurement.prcp).\
        filter(func.strftime("%Y-%m-%d", Measurement.date) >= dt.date(2016, 8, 23)).all()

    # Create dict with date as key and prcp as the value.
    prcp = {date: prcp for date, prcp in precipitation_data}
    
    return jsonify(prcp)
Return prcp data for previous year
Return prcp data for previous year
Return prcp data for previous year
def precipitation():
    precipitation_data = session.query(func.strftime("%Y-%m-%d", Measurement.date), Measurement.prcp).\
        filter(func.strftime("%Y-%m-%d", Measurement.date) >= dt.date(2016, 8, 23)).all()
    prcp = {date: prcp for date, prcp in precipitation_data}
    return jsonify(prcp)
def precipitation ( ) : precipitation_data = session . query ( func . strftime ( "%Y-%m-%d" , Measurement . date ) , Measurement . prcp ) . filter ( func . strftime ( "%Y-%m-%d" , Measurement . date ) >= dt . date ( 2016 , 8 , 23 ) ) . all ( ) prcp = { date : prcp for date , prcp in precipitation_data } return jsonify ( prcp )
Return prcp data for previous year
Return prcp data for previous year
"""Return prcp data for previous year""" # Design a query to retrieve the last 12 months of precipitation data and plot the results # Calculate the date 1 year ago from the last data point in the database # Perform a query to retrieve the data and precipitation scores # Create dict with date as key and prcp as the value.