Skip to content

This repo consists of the scripts and results files associated with the pythhon api challenge done as homework for the MSU Data Science Boot Camp

Notifications You must be signed in to change notification settings

KenSaville/python-api-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

python-api-challenge

Python API Homework - What's the Weather Like?

Part I - WeatherPy

Created a Python script to visualize the weather of 500+ cities across the world of varying distance from the equator.

Used some starter code to generate a list of cities doing an API call to https://pypi.python.org/pypi/citipy.

Used the above list of cities to do API calls for weather conditions using request calls to: OpenWeatherMap API](https://openweathermap.org/api),

Created scatter plots showing the following relationships for all analyzed cities.

  • Temperature (F) vs. Latitude
  • Humidity (%) vs. Latitude
  • Cloudiness (%) vs. Latitude
  • Wind Speed (mph) vs. Latitude

Separated cities into Northern Hemisphere (latitude > 0) and Southern Hemisphere (less than 0 degrees latitude). Analyzed the above relationships for each new set of cities.

Also - plotted absolute value of latitude vs temperature, to show relationshio of raw distance (regardless of negative or positive values) from equator to temp.

Figures of each figure were saved as png files.

Sacatter plots and saved figures were genrated using a function called make_scatter_plot. This function takes as arguments: The name of the dataframe, the column name to be used as X values and the column name to be used as Y values. It uses this data to calulate Pearson's correlation coefficient and makes a scatter plot of the data. Finally it saves the figure as a png file, using a title based on the input Df and X and Y columns. A random number is generated and added to the figure name to distinguish figures from each other.

WeatherPy also generates a csv file containing the weather information obtained from the openweathermap api

Part II - VacationPy

This script first imported a csv generated in WeatherPy containing > 500 cities and associated weather data. Note - the two scripts are not 'connected', The weatherPy script is run to generate the CSV file, then this file is independently imported into VacationPy. Because of this, the output from vacationPy may not match the most recent CSV file generated by WeatherPy

Once the CSV file is imported as a dataframe, a heat map that displays the humidity for every city is generated.

The script then narrows down the cities to those with 'ideal' weather conditions resulting in ~10-11 cities.

Next, the Google Places API was used to find the first hotel for each city located within 5000 meters of the city coordinates.

The hotels were plotted as markers on top of the humidity heatmap with each pin containing the Hotel Name, City, and Country.

About

This repo consists of the scripts and results files associated with the pythhon api challenge done as homework for the MSU Data Science Boot Camp

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages