Skip to content

Nearest Hotel availability Recommendation system as per location, Required City Range, weather requirements, Temp inputs and avaibility for Future Holiday and Vacation destination

Notifications You must be signed in to change notification settings

RoshniRanaDS27/Python_API_Challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

Nearest Hotel availability & Recommendation system (Python API)

Filters Available For Hotels Recommendation as per location, Required City Range, weather requirements, Temp inputs and avaibility for Future Holiday and Vacation destination Trips In Required City

Project 14

This activity was broken down into two deliverables, WeatherPy and VacationPy.

Part 1: WeatherPy

In this deliverable, created a Python script to visualize the weather of over 500 cities at varying distances from the equator. used the Citipy Python library, the OpenWeatherMap API, and your problem-solving skills to develop a representative model of weather across cities. image

  • For this part, used the WeatherPy.ipynb Jupyter notebook provided in the starter code ZIP file. The starter code guided through the process of using your Python coding skills to develop a solution that addressed the required functionalities.
  • To get started, the code required to generate random geographic coordinates and find the nearest city to each latitude and longitude combination was provided. image image

1. Visualizing Weather Variables:

Using the OpenWeatherMap API, you retrieved weather data and created scatter plots to examine the relationships between latitude and various weather variables, including temperature, humidity, cloudiness, and wind speed.

2. Computing Linear Regression:

For each weather variable against latitude, you computed linear regression to analyze trends. The analysis was divided into Northern Hemisphere (≥0° latitude) and Southern Hemisphere (<0° latitude) to identify any distinct patterns. Scatter plots were created with regression lines, model formulas, and R² values to illustrate these relationships.

Requirement 1: Created Plots to Showcase the Relationship Between Weather Variables and Latitude

To fulfill the first requirement,

used the OpenWeatherMap API to retrieve weather data from the cities list generated in the starter code. Then, created a series of scatter plots to showcase the following relationships:

image image image image image

  • Latitude vs. Temperature
    image

  • Latitude vs. Humidity
    image

  • Latitude vs. Cloudiness image

  • Latitude vs. Wind Speed
    image

Requirement 2: Computed Linear Regression for Each Relationship

To fulfill the second requirement,

computed the linear regression for each relationship. The plots were separated into the Northern Hemisphere (greater than or equal to 0 degrees latitude) and the Southern Hemisphere (less than 0 degrees latitude). You may have found it helpful to define a function to create the linear regression plots.

Next, created a series of scatter plots and included the linear regression line, the model's formula, and the r² values. The following plots were generated:

  • Northern Hemisphere: Temperature vs. Latitude image

  • Southern Hemisphere: Temperature vs. Latitude image

  • Northern Hemisphere: Humidity vs. Latitude image

  • Southern Hemisphere: Humidity vs. Latitude
    image

  • Northern Hemisphere: Cloudiness vs. Latitude image

  • Southern Hemisphere: Cloudiness vs. Latitude image

  • Northern Hemisphere: Wind Speed vs. Latitude image image

  • Southern Hemisphere: Wind Speed vs. Latitude image

After each pair of plots, explained what the linear regression was modeling, described any relationships noticed, and highlighted other findings you uncovered.

Part 2: VacationPy

In this deliverable, weather data skills were used to plan future vacations. Additionally, Jupyter notebooks, the geoViews Python library, and the Geoapify API were utilized. applied weather data insights to plan vacations using map visualizations.

tasks included:

1. Creating Map Visualizations:

Using the geoViews Python library and the Geoapify API, you created a map that displayed points for each city, with point size representing humidity levels.

2. Finding Ideal Vacation Locations:

By filtering the data to meet specific weather criteria (e.g., temperatures between 21-27°C, wind speeds less than 4.5 m/s, and zero cloudiness), you identified cities with ideal weather conditions.

3. Locating Hotels:

A new DataFrame, hotel_df, was created to store city details and humidity. The Geoapify API was used to locate hotels within 10,000 meters of each city’s coordinates, with additional information on hotel names and countries added to the map’s hover messages.

This project provided a comprehensive approach to analyzing weather data and applying it to practical vacation planning scenarios.

The code needed to import the required libraries and load the CSV file containing the weather and coordinates data for each city created in Part 1 was provided to help get started. image

The main tasks involved using the Geoapify API, the geoViews Python library, and Python skills to create map visualizations.
To complete this part of the assignment, the VacationPy.ipynb starter code was opened and the following steps were followed: image

  • A map was created, displaying a point for every city in the city_data_df DataFrame, where the size of the point represented the humidity in each city. image

  • The city_data_df DataFrame was narrowed down to find ideal weather conditions. For example:

    • A maximum temperature lower than 27 degrees but higher than 21 degrees
    • Wind speed less than 4.5 m/s
    • Zero cloudiness image image

    (Specifications could be adjusted, but a reasonable limit was ensured on the number of rows returned by API requests.)

  • A new DataFrame called hotel_df was created to store the city, country, coordinates, and humidity. image image image

  • For each city, the Geoapify API was used to find the first hotel located within 10,000 meters of the coordinates. image

  • The hotel name and the country were added as additional information in the hover message for each city on the map.

  • image

Project Setup and Configuration

Organized Files: In local repository, created a new directory for this assignment, named WeatherPy. Inside this directory, you placed the following files from the

provided starter code ZIP file: api_keys.py, WeatherPy.ipynb, and VacationPy.ipynb.

Added a .gitignore File: To prevent sensitive files like api_keys.py from being shared publicly, you created a .gitignore file in your repository. This file included:arduino

Adding config.py file.

api_keys.py (ADDED to git.ignore)

Committed Your Changes: used the command git status to review untracked files. added the .gitignore, WeatherPy.ipynb, and VacationPy.ipynb files using git add, then committed and pushed changes. ensured that only WeatherPy.ipynb and VacationPy.ipynb were visible on GitHub, keeping api_keys.py private.

About

Nearest Hotel availability Recommendation system as per location, Required City Range, weather requirements, Temp inputs and avaibility for Future Holiday and Vacation destination

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published