Skip to content

Commit 04d9730

Browse files
committed
README.md file updated
1 parent d6b5d8d commit 04d9730

File tree

1 file changed

+88
-3
lines changed

1 file changed

+88
-3
lines changed

README.md

Lines changed: 88 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,94 @@
1-
# python-api-challenge
1+
# Python-API-Challenge
2+
3+
## Challenge Description
4+
5+
This challenge has been split into two sub-challenges. The first 'WeatherPy' tasked me with obtaining the weather from the 'OpenWeatherMap API' for 500 cities across the world, with the data collected being output to a CSV file before being read into the second task 'VacationPy'. In the second task, using the data within the CSV, locate hotels using the 'Geoapify API' within certain Cities to plan my next vacation!
6+
7+
## WeatherPy
8+
9+
### Obtaining the Data
10+
11+
- Citipy libary code already provided to obtain a random selection of Longitude and Latitude values and the nearest City.
12+
- Using the 'OpenWeatherMap API' iterate through the cities identified by the Citipy:
13+
- Through the JSON result for each city obtain:
14+
- Latitude
15+
- Longitude
16+
- Max Temp
17+
- Humidity
18+
- Cloud cover
19+
- Wind speed
20+
- Country code
21+
- Date
22+
- Append the obtained data to the 'city_data' list
23+
- Create a dataframe from the 'city_data' list
24+
- Save the dataframe to CSV ready for the 'VacationPy' task
25+
26+
### Generate Scatter plots
27+
28+
- Using the data collected, generate scatter plots for:
29+
- Latitude vs Temperature (c)
30+
- Latitude vs. Humidity (%)
31+
- Latitude vs. Cloudiness (%)
32+
- Latitude vs. Wind Speed (m/s)
33+
- Note: To save time/repetitve coding, I created a function to generate the base scatter plots and then just added additional lines for the titles/labels
34+
35+
### Compute Linear Regression
36+
37+
- Separate the Citie's from the previous dataframe into Northern and Southern Hemisphere dataframes
38+
- Create a function to compute the linear regression for the previously created plots, broken down into Northern and Southern Hemisphere dataframes
39+
- Create plots, linear regression and Line Equation for the following relationships:
40+
- Northern Hemisphere: Temperature vs. Latitude
41+
- Southern Hemisphere: Temperature vs. Latitude
42+
- Northern Hemisphere: Humidity vs. Latitude
43+
- Southern Hemisphere: Humidity vs. Latitude
44+
- Northern Hemisphere: Cloudiness vs. Latitude
45+
- Southern Hemisphere: Cloudiness vs. Latitude
46+
- Northern Hemisphere: Wind Speed vs. Latitude
47+
- Southern Hemisphere: Wind Speed vs. Latitude
48+
49+
50+
## VacationPy
51+
52+
### Plot the Cities on a World Map
53+
54+
- Using the CSV from the previous 'city_data_df' plot each City on a hvplot world map
55+
- The size of the marker should be determined by the 'Humidity' value of each City
56+
- And each City point should be coloured differently
57+
58+
### Add conditions to limit the number of Cities
59+
60+
- I added three conditions to reducde the number of cities down:
61+
- Temperature should be <= 30
62+
- Temperature should be >= 20
63+
- Cloudiness should be == 0
64+
- This reduced dataset was then renamed to 'hotel_df' consisting of the following columns:
65+
- City
66+
- Country
67+
- Longitude
68+
- Latitude
69+
- Humidity
70+
- Hotel Name - This was an empty column added to the dataframe ready for the next task
71+
72+
### Locate nearest Hotel to each City in 'hotel_df'
73+
74+
- Using the 'Geoapify API' iterate through each City within the 'hotel_df' and find:
75+
- The nearest Hotel
76+
- Within 10km of the Latitude and Longitude of the city
77+
- Append the name of the hotel to the 'Hotel Name' column of the DataFrame
78+
- I added an additional step to filter out any Cities where a hotel was not found within the search area
79+
- Using the 'hotel_df' generate another world map to show each City which met the previous conditions set
80+
- Add the 'Hotel Name' and 'Country' to the hover message for each point
81+
82+
### Notes
83+
84+
After pushing the VacationPy.ipynb file to GitHub, I noticed the maps from the hvplot were not showing within the GitHub Jupyter Notebook viewer. I've added PNG files of the maps into an 'output_data' folder within the 'VacationPy' directory to demonstate successful plotting.
285

3-
## WeatherPy
486

587
### References
688

7-
- Code for conerting Unix timestamp from 'Date' column to a Date Format - https://stackoverflow.com/a/75222939/21871037
89+
- Code for converting Unix timestamp from 'Date' column to a Date Format - https://stackoverflow.com/a/75222939/21871037
890
- Code used in an attempt to stop the labels/titles being cut off with the 'savefig' function - https://ecoagi.ai/topics/Matplotlib/matplotlib-savefig-cuts-off-labels#saving-the-figure-with-bbox_inchestight
91+
- Initial coding - edX Boot Camps LLC
92+
- Weather data - OpenWeatherMap API
93+
- Hotel Data - Geoapify API
994

0 commit comments

Comments
 (0)