Design a query to find the most active stations

Assignment Help Python Programming
Reference no: EM132397378

SQLAlchemy Homework.

Python, SQLAlchemy, Pandas, Flask API

## Step 1 - Climate Analysis and Exploration

All of the following analysis should be completed using Python, SQLAlchemy ORM queries, Pandas, FLASK, and Matplotlib.

Use Python and SQLAlchemy to do basic climate analysis and data exploration of your climate database.

Two starter files have been provided.

1) pandas_starter.ipynb

2) app.py

Two directories with datafiles have been provided;

1) Images

2) Resources

Steps 1-11 have been completed, need help with steps 12-17.

12) Design a query to find the most active stations.

12a) List the stations and observation counts in descending order, and display top 3.

12b) Which station has the highest number of observations? Display results.

12c) Hint: You may need to use functions such as `func.min`, `func.max`, `func.avg`, and `func.count` in your queries.

13) Design a query to retrieve the last 12 months of temperature observation data (tobs).

13a) Filter by the station with the highest number of observations, and display top 3.

13b) Plot the results as a histogram with `bins=12`.

13c) Use Pandas to plot/display/save query as a bar chart.

13d) Save the plot as Images/station-histogram_myPlot.png

# Example of expected output [station-histogram](Images/station-histogram.png)

- - -

## Step 2 - Climate App

Now that you have completed your initial analysis, design a Flask API based on the queries that you have just developed.

14) Use FLASK to create your routes in filenamed app.py.

### Routes

* `/`

* Home Webpage.

* List all routes that are available.

* `/api/v1.0/precipitation`

* Convert the query results to a Dictionary using `date` as the key and `prcp` as the value.

* Return the JSON representation of your dictionary.

* `/api/v1.0/stations`

* Return a JSON list of stations from the dataset.

* `/api/v1.0/tobs`

* query for the dates and temperature observations from a year from the last data point.

* Return a JSON list of Temperature Observations (tobs) for the previous year.

* `/api/v1.0/<start>` and `/api/v1.0/<start>/<end>`

* Return a JSON list of the minimum temperature, the average temperature, and the max temperature for a given start or start-end range.

* When given the start only, calculate `TMIN`, `TAVG`, and `TMAX` for all dates greater than and equal to the start date.

* When given the start and the end date, calculate the `TMIN`, `TAVG`, and `TMAX` for dates between the start and end date inclusive.

## Hints

* You will need to join the station and measurement tables for some of the analysis queries.

* Use Flask `jsonify` to convert your API data into a valid JSON response object.

- - -

## Step 3 - Analysis

15) Temperature Analysis I

* Use Pandas's `read_csv()` to perform this portion.

* Hawaii is reputed to enjoy mild weather all year. Is there a meaningful difference between the temperature in, for example, June and December?

* Identify the average temperature in June at all stations across all available years in the dataset. Do the same for December temperature.

* Use the t-test to determine whether the difference in the means, if any, is statistically significant. Will you use a paired t-test, or an unpaired t-test? Why?

16) Temperature Analysis II

* Use Pandas's to perform this portion.

* The starter notebook contains a function called `calc_temps` that will accept a start date and end date in the format `%Y-%m-%d` and return the minimum, average, and maximum temperatures for that range of dates.

* Use the `calc_temps` function to calculate the min, avg, and max temperatures for your trip using the matching dates from the previous year (i.e., use "2017-01-01" if your trip start date was "2018-01-01").

* Plot the min, avg, and max temperature from your previous query as a bar chart.

* Use the average temperature as the bar height.

* Use the peak-to-peak (tmax-tmin) value as the y error bar (yerr).

* Use Pandas to plot/display/save query as a bar chart.

# Example of expected output ![temperature](Images/temperature.png)

17) Daily Rainfall Average

* Use Pandas's to perform this portion.

* Calculate the rainfall per weather station using the previous year's matching dates.

* Calculate the daily normals. Normals are the averages for the min, avg, and max temperatures.

* You are provided with a function called `daily_normals` that will calculate the daily normals for a specific date. This date string will be in the format `%m-%d`. Be sure to use all historic tobs that match that date string.

* Create a list of dates for your trip in the format `%m-%d`. Use the `daily_normals` function to calculate the normals for each date string and append the results to a list.

* Load the list of daily normals into a Pandas DataFrame and set the index equal to the date.

* Use Pandas to plot/display/save an area plot (`stacked=False`) for the daily normals.

# Example of expected output ![daily-normals](Images/daily-normals.png)

Reference no: EM132397378

Questions Cloud

Discusses the use of social control theory : The student will develop an essay that discusses the use of social control theory and how it works or doesn't work in controlling crime in the community
What are common mistakes people make in preparing resumes : What are the most common mistakes people make in preparing their résumés? What should you know about your prospective employer before the job interview?
How is their agenda pushed and promoted : What is their legislative agenda; how is the agenda developed; how is it communicated to members; how is their agenda pushed and promoted.
Important issue and identify a knowledge deficit : Draw on at least one of the articles in this course to examine the existing knowledge on an important issue and identify a knowledge deficit
Design a query to find the most active stations : Design a query to find the most active stations. List the stations and observation counts in descending order, and display top 3.
How do you separate your personal beliefs and the ethics : How do you separate your personal beliefs/values and the ethics of practice in nursing? Include an example. Your paper should be at least 500 words.
Analyze the psychological issues that the population faces : In this Discussion, you select a special population and analyze the psychological issues that the population faces. You also address the assessment.
Discuss about the time management in nursing : Interviewing a Professional Nurse or Interview a nurse professional with years of experience. Time management in nursing, Communication style.
Describe the way in which the sampling distribution changes : Describe the way in which the sampling distribution changes as we increase the sample size. Do we need to invoke the Central Limit Theorem to achieve the Normal

Reviews

len2397378

11/5/2019 10:19:44 PM

All of the following analysis should be completed using Python, SQLAlchemy ORM queries, Pandas, FLASK, and Matplotlib. Use Python and SQLAlchemy to do basic climate analysis and data exploration of the database. A homeworkInstructions2.txt file has been provided. Two starter files have been provided. 1) pandas_starter.ipynb 2) app.py Two directories with datafiles have been provided; 1) Images - This contains example of what the output should look like. 2) Resources - Input files. Steps 1-11 have been completed, need help with steps 12-17.

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd