<jupyter_start><jupyter_text>WeatherPy---- Note* Instructions have been included for each segment. You do not have to follow them exactly, but they are included to help you think through the steps.<jupyter_code># Dependencies and Setup
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import requests
import time
from scipy.stats import linregress
from pprint import pprint

# Import API key
from api_keys import weather_api_key

# Incorporated citipy to determine city based on latitude and longitude
from citipy import citipy

# Output File (CSV)
output_data_file = "output_data/cities.csv"

# Range of latitudes and longitudes
lat_range = (-90, 90)
lng_range = (-180, 180)

#daily 7 day forecast API

#weather_api_key<jupyter_output><empty_output><jupyter_text>Generate Cities List<jupyter_code># List for holding lat_lngs and cities
lat_lngs = []
cities_list = []

# Create a set of random lat and lng combinations
lats = np.random.uniform(lat_range[0], lat_range[1], size=1500)
lngs = np.random.uniform(lng_range[0], lng_range[1], size=1500)
lat_lngs = zip(lats, lngs)

# Identify nearest city for each lat, lng combination
for lat_lng in lat_lngs:
    city = citipy.nearest_city(lat_lng[0], lat_lng[1]).city_name
    
    # If the city is unique, then add it to a our cities list
    if city not in cities_list:
        cities_list.append(city)

# Print the city count to confirm sufficient count
len(cities_list)
#print(city)
#print(cities_list) #print a list of the cities_list
# this is your api url link, we fill it in below. 
#api.openweathermap.org/data/2.5/weather?q={city name}&appid={API key}
base_url= "http://api.openweathermap.org/data/2.5/weather?"
#city_one= "Denver"

query_url= base_url+ "appid="+weather_api_key+ "&q=" + city
print(query_url) #click on this url and put into Google.

#query_url='api.openweathermap.org/data/2.5/weather?q={city}&appid={weather_api_key}'
#query_url

weather_response=requests.get(query_url)
weather_json=weather_response.json()
#pprint(f'The weather API responded with: {weather_json}.')

pprint(weather_json)<jupyter_output>{'base': 'stations',
 'clouds': {'all': 40},
 'cod': 200,
 'coord': {'lat': -24.85, 'lon': 152.35},
 'dt': 1614565124,
 'id': 2173323,
 'main': {'feels_like': 303.45,
          'humidity': 51,
          'pressure': 1009,
          'temp': 304.21,
          'temp_max': 304.26,
          'temp_min': 304.15},
 'name': 'Bundaberg',
 'sys': {'country': 'AU',
         'id': 9501,
         'sunrise': 1614541511,
         'sunset': 1614586871,
         'type': 1},
 'timezone': 36000,
 'visibility': 10000,
 'weather': [{'description': 'scattered clouds',
              'icon': '03d',
              'id': 802,
              'main': 'Clouds'}],
 'wind': {'deg': 70, 'speed': 6.17}}<jupyter_text>Perform API Calls* Perform a weather check on each city using a series of successive API calls.* Include a print log of each city as it'sbeing processed (with the city number and city name).<jupyter_code>#below is the base URL to access the openweather api data. Remove all data after ? 

#base_url= "http://api.openweathermap.org/data/2.5/weather?"


# City	Lat	Lng	Max Temp	Humidity	Cloudiness	Wind Speed	Country	Date
#create empty list for your eventual dataframe
city_list_500=[]
lat_500=[]
long_500=[]
max_temp_500=[]
humidity_500=[]
wind_speed_500=[]
cloudiness_500=[]
country_500=[]
date_500=[]
counter=0
group=1



#[:3] gives me back 3 results from the cities_list. 
# for loop itreeather list of randomeng enerrate scitis, pings the opena 
for each_city in cities_list[:]: 
    #query_url= base_url+ "appid="+weather_api_key+ "&q=" + city
    query_url=f'{base_url}q={each_city}&appid={weather_api_key}'
    weather_response=requests.get(query_url)
    weather_data=weather_response.json()
    counter= counter +1
    
    #pprint(weather_data) #keep this in the for loop so that it prints out the amount you want
    try:
        city_list_500.append(weather_data['name'])
        lat_500.append(weather_data['coord']['lat'])
        #print(lat_500)
        long_500.append(weather_data['coord']['lon'])
        max_temp_500.append(weather_data['main']['temp_max'])
        humidity_500.append(weather_data['main']['humidity'])
        cloudiness_500.append(weather_data['clouds']['all'])
        wind_speed_500.append(weather_data['wind']['speed'])
        country_500.append(weather_data['sys']['country'])
        date_500.append(weather_data['dt'])
        if counter >50:
            counter=1
            group=1 +group
        #print(f" Processing record number {len(city_list_500)} for the city of {each_city}")
        print(f" Processing record number {counter} for Set {group} the city of {each_city}")
        
    except:
        print('City not found. Skipping...')
        pass

    # need to print out 50 and then new list shows up. look at starter file
    # hint: these are counters
    # 

# print(city_list_500)
# print(lat_500)
# print(long_500)
# print(max_temp_500)
# print(humidity_500)
# print(wind_speed_500)
# print(cloudiness_500)
# print(country_500)
# print(date_500)

len(city_list_500)
# print(city_list_500)
# print(lat_500)
# print(long_500)
# print(max_temp_500)
# print(humidity_500)
# print(wind_speed_500)
# print(cloudiness_500)
# print(country_500)
# print(date_500)

# # highlight them all and hit command ? to comment these
# #<jupyter_output><empty_output><jupyter_text>Convert Raw Data to DataFrame* Export the city data into a .csv.* Display the DataFrame<jupyter_code>#create a dictionary and then pass to data frame 

# how can we run the API calls so that the output is equal to 500.

# is there a way to set = to 500?

weather_data_dict= {'City': city_list_500,
                       'Latitude': lat_500,
                       'Longitude': long_500,
                       'Max Temp': max_temp_500,
                       'Humidity': humidity_500,
                       'Cloudiness': cloudiness_500,
                       'Wind Speed': wind_speed_500,
                       'Country' : country_500,
                       'Date': date_500
                      }
weather_data_df_zero=pd.DataFrame(weather_data_dict)
weather_data_df_zero.head()

#export the city data into a .csv

#print a describe table for the weather data frame
# the df_zero is the original dict we are using to run the API calls 
weather_data_df_zero.describe()

# you are getting the same count<jupyter_output><empty_output><jupyter_text>Inspect the data and remove the cities where the humidity > 100%.----Skip this step if there are no cities that have humidity > 100%.<jupyter_code># create a filter to filter out cities that have humidity >100%
# weather_data_one applies the humidity filter to weather_data_df_zero
humidity_filter=weather_data_df_zero.loc[:, "Humidity"]<=100 
weather_data_df_one=weather_data_df_zero.loc[humidity_filter,:]
#.loc[ is saying grab all the rows and the humidity coul]
#humidity_filter
#weather_data_df_one.describe() #weather data_df_one is cities with less than or equal to 100% humidity
weather_data_df_one.describe()

#another way to get a filter, different syntax

#print_me=weather_data_df_zero.loc[weather_data_df_zero['Humidity']<=100]
#print_me #no comma : it assumes you want all the columns

weather_data_df_one.to_csv("weather_data_one.csv")
len(weather_data_df_one)

# Get the indices of cities that have humidity over 100%.
humidity_over_filter=weather_data_df_zero.loc[:, 'Humidity']>100
weather_over_df=weather_data_df_zero.loc[humidity_over_filter,:]
list(weather_over_df.index)
weather_over_df.index
# there are no indicies over 100
# you can do this through itterrows

# Make a new DataFrame equal to the city data to drop all humidity outliers by index.
# Passing "inplace=False" will make a copy of the city_data DataFrame, which we call "clean_city_data".<jupyter_output><empty_output><jupyter_text>Plotting the Data* Use proper labeling of the plots using plot titles (including date of analysis) and axes labels.* Save the plotted figures as .pngs.  Latitude vs. Temperature Plot<jupyter_code>#The first requirement is to create a series of scatter plots to showcase the following relationships:

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

#After each plot, add a sentence or two explaining what the code is analyzing.
# These are notes only, no lines of code in this cell

# In the spherical system, horizontal lines, or east–west lines, are lines of equal latitude, or parallels. 
# Vertical lines, or north–south lines, are lines of equal longitude, or meridians. 
# These lines encompass the globe and form a gridded network called a graticule

# It may be helpful to equate longitude values with X and latitude values with Y.
# Data defined on a geographic coordinate system is displayed as if a degree is a linear unit of measure.

# Latitude and longitude values are traditionally measured either in decimal degrees or in degrees, minutes, and seconds (DMS).

# Latitude values are measured relative to the equator and range from -90° at the South Pole to +90° at the North Pole. 
# Longitude values are measured relative to the prime meridian. They range from -180° when traveling west to 180° when traveling east. 
# If the prime meridian is at Greenwich, then Australia, which is south of the equator and east of Greenwich, has positive longitude values and negative latitude values.
# Scatter plot of max temp vs latitude for weather data after filtering out cities with humidity >100
x_lat=weather_data_df_one['Latitude']
y_maxtemp=weather_data_df_one['Max Temp']

plt.scatter(x_lat, y_maxtemp)
plt.title("Max Temperature vs Latitude") 
plt.xlabel('Latitude')
plt.ylabel('Max Temperature (K)')
plt.grid(True)

#print statement
plt.savefig('../WeatherPy/Max_Temp_vs._Latitude.png')

print(f' This sample shows as one moves closer to the equator the temperature increases.') 
print(f' This is because of less sunlight the further away one goes from the equator.')
#      Can you name all the countries on the equator?')<jupyter_output>This sample shows as one moves closer to the equator the temperature increases.
 This is because of less sunlight the further away one goes from the equator.<jupyter_text>Latitude vs. Humidity Plot<jupyter_code>x_lat=weather_data_df_one['Latitude']
y_humidity=weather_data_df_one['Humidity']

plt.scatter(x_lat, y_humidity)
#plt.scatter(x_lat, y_maxtemp)
plt.title('Humidity vs Latitude')
plt.xlabel('Latitude')
plt.ylabel('Humidity (%)')
plt.grid(True)

#print statement
plt.savefig('../WeatherPy/Humidity_vs._Latitude.png')

print(f' This sample shows consistent humidity levels around the globe for most cities .')
print(f' There appear to be outliers. We could plot a boxplot to check for outliers.')
print(f' There world could not survive without humidity')
# \'  is how you f string a '
# what might be perceived as outliers.')<jupyter_output>This sample shows consistent humidity levels around the globe for most cities .
 There appear to be outliers. We could plot a boxplot to check for outliers.
 There world could not survive without humidity<jupyter_text>Latitude vs. Cloudiness Plot<jupyter_code># Scatter plot of max temp vs latitude for weather data after filtering out cities with humidity >100
x_lat=weather_data_df_one['Latitude']
y_cloudiness=weather_data_df_one['Cloudiness']

plt.scatter(x_lat, y_cloudiness)
plt.title('Cloudiness vs. Latitude') #how to use % and ' in f string???
plt.xlabel('Latitude')
plt.ylabel('Cloudiness')
plt.grid(True)

#print statement
plt.savefig('../WeatherPy/Cloudiness_vs._Latitude.png')

print(f' There was no correlation between city latitude and cloudiness in the sample of cities.')<jupyter_output>There was no correlation between city latitude and cloudiness in the sample of cities.<jupyter_text>Latitude vs. Wind Speed Plot<jupyter_code>x_lat=weather_data_df_one['Latitude']
y_wind_speed=weather_data_df_one['Wind Speed']

plt.scatter(x_lat, y_wind_speed)
plt.title('Wind Speed vs City Latitude')
plt.xlabel('Latitude')
plt.ylabel('Wind Speed')
plt.grid(True)

#print statement
plt.savefig('../WeatherPy/Wind Speed_vs._Latitude.png')

print(f' This doesn\'t look like there is much correlation.') 
print(f' The further you move toward each pole the more windy it appears to be.')
print(f' Latitude values are measured relative to the equator') 
print(f' and range from -90° at the South Pole to +90° at the North Pole.')<jupyter_output>This doesn't look like there is much correlation.
 The further you move toward each pole the more windy it appears to be.
 Latitude values are measured relative to the equator
 and range from -90° at the South Pole to +90° at the North Pole.<jupyter_text>Linear Regression<jupyter_code># latitude greater than 0 is northern
# latitude less than 0 is southern
# #print statement
# look in the read me file 


#https://towardsdatascience.com/simple-and-multiple-linear-regression-in-python-c928425168f9
# read this and then proceed next time
northern_hem_filter=weather_data_df_one.loc[:, "Latitude"]>=0 #on the equator included
northern_hem_df=weather_data_df_one.loc[northern_hem_filter,:]
northern_hem_df.describe()
# this is your northern_hemisphere_dataframe filter
southern_hem_filter=weather_data_df_one.loc[:, "Latitude"]<0 #on the equator included
southern_hem_df=weather_data_df_one.loc[southern_hem_filter,:]
southern_hem_df.describe()
# this is your southern_hemisphere_dataframe filter
len(southern_hem_df)
# this plus northern_hem_df should add up to your weather_data_df_one 
len(northern_hem_df)
#(slope, intercept, rvalue, pvalue, stderr) = linregress(x_values, y_values)
#regress_values = x_values * slope + intercept

# x_lat=weather_data_df_one['Latitude']
# y_wind_speed=weather_data_df_one['Wind Speed']

# (slope, intercept, rvalue, pvalue, stderr) = linregress(x_lat, y_wind_speed)
# regress_values = x_lat * slope + intercept
# line_eq = "y = " + str(round(slope,2)) + "x + " + str(round(intercept,2))
# plt.scatter(x_lat,y_wind_speed)
# plt.plot(x_lat,regress_values,"r-")
# plt.annotate(line_eq,(0,5),fontsize=15,color="red")
# plt.xlabel('')
# plt.ylabel('')
# print(f"The r-squared is: {rvalue**2}")
# plt.show()
# print(f' )

# #slope, intercept, rvalue, pvalue, stderr = linregress(x, y) #list unpacking 
# # y=mx+b #every straight line can be represented by this equation
# #regression=slope+x+intercept
# #regression_label=(f'y={round(slope,2)}x+{round(intercept,2)}')

# #liner regression is trying to draw a line as close as possible to the most dots<jupyter_output><empty_output><jupyter_text>Northern Hemisphere - Max Temp vs. Latitude Linear Regression<jupyter_code>x_lat=northern_hem_df['Latitude']
y_maxtemp=northern_hem_df['Max Temp']


# (slope, intercept, rvalue, pvalue,stderr)= linregress(x_lat, y_maxtemp)
# plt.scatter(x_lat, y_maxtemp)
# plt.title('City Latitude vs Max Temperature')
# plt.xlabel('Latitude')
# plt.ylabel('Max Temperature (K)')
# plt.grid(True)


(slope, intercept, rvalue, pvalue, stderr) = linregress(x_lat, y_maxtemp)
regress_values = x_lat * slope + intercept
line_eq = "y = " + str(round(slope,2)) + "x + " + str(round(intercept,2))
plt.scatter(x_lat,y_maxtemp)
plt.plot(x_lat,regress_values,"r-")
plt.annotate(line_eq,(10,240),fontsize=15,color="red")
plt.title('Northern Hemisphere: City Latitude vs Max Temp ')
plt.xlabel('Latitude')
plt.ylabel('Max Temp')
print(f"The r-squared is: {rvalue**2}")
#plt.xlim(0,90)
#plt.ylim(0,110)

plt.grid(True)
plt.show()
print(f' This regression appears tight but as you move closer to the north pole')
print(f' the data is less correlated.')
#=300-200
# based off this regression, we can expect the max temp 
plt.savefig('../WeatherPy/Northern_Latitude vs Max Temp.png')<jupyter_output>The r-squared is: 0.7150500866959828<jupyter_text>Southern Hemisphere - Max Temp vs. Latitude Linear Regression<jupyter_code>x_lat=southern_hem_df['Latitude']
y_maxtemp=southern_hem_df['Max Temp']


# (slope, intercept, rvalue, pvalue,stderr)= linregress(x_lat, y_maxtemp)
# plt.scatter(x_lat, y_maxtemp)
# plt.title('City Latitude vs Max Temperature')
# plt.xlabel('Latitude')
# plt.ylabel('Max Temperature (K)')
# plt.grid(True)


(slope, intercept, rvalue, pvalue, stderr) = linregress(x_lat, y_maxtemp)
regress_values = x_lat * slope + intercept
line_eq = "y = " + str(round(slope,2)) + "x + " + str(round(intercept,2))
plt.scatter(x_lat,y_maxtemp)
plt.plot(x_lat,regress_values,"r-")
plt.annotate(line_eq,(-70,288),fontsize=15,color="red")
plt.title('Southern Hemisphere: City Latitude vs Max Temp ')
plt.xlabel('Latitude')
plt.ylabel('Max Temp')
print(f"The r-squared is: {rvalue**2}")
#plt.xlim(0,90)
#plt.ylim(0,110)

plt.grid(True)
plt.show()

print(f' City latitude appears less correlated than the Northern Hemisphere')
print(f' but this might be because the sample set are not equal. There is')
print(f' a little more than 2 times the samples in Northern vs Southern.')
#plt.savefig()
#find the line where you have the smallest distance between the point of the data set
plt.savefig('../WeatherPy/Southern_Latitude vs Max Temp.png')<jupyter_output>The r-squared is: 0.2893311006019193<jupyter_text>Northern Hemisphere - Humidity (%) vs. Latitude Linear Regression<jupyter_code>x_lat=northern_hem_df['Latitude']
y_humidity=northern_hem_df['Humidity']


# (slope, intercept, rvalue, pvalue,stderr)= linregress(x_lat, y_maxtemp)
# plt.scatter(x_lat, y_maxtemp)
# plt.title('City Latitude vs Max Temperature')
# plt.xlabel('Latitude')
# plt.ylabel('Max Temperature (K)')
# plt.grid(True)


(slope, intercept, rvalue, pvalue, stderr) = linregress(x_lat, y_humidity)
regress_values = x_lat * slope + intercept
line_eq = "y = " + str(round(slope,2)) + "x + " + str(round(intercept,2))
plt.scatter(x_lat,y_humidity)
plt.plot(x_lat,regress_values,"r-")
plt.annotate(line_eq,(20,20),fontsize=15,color="red")
plt.title('Northern Hemisphere: City Latitude vs Humidity ')
plt.xlabel('Latitude')
plt.ylabel('Humidity')
print(f"The r-squared is: {rvalue**2}")
#plot.xlim(min, max)
plt.xlim(0,90)
plt.ylim(0,110)
plt.grid(True)

print(f' City latitude vs humidity shows there isn\'t a tight relationship')
plt.show()

plt.savefig('../WeatherPy/Northern_Latitude vs Humidity.png')<jupyter_output>The r-squared is: 0.10445315980682346
 City latitude vs humidity shows there isn't a tight relationship<jupyter_text>Southern Hemisphere - Humidity (%) vs. Latitude Linear Regression<jupyter_code>x_lat=southern_hem_df['Latitude']
y_humidity=southern_hem_df['Humidity']


# (slope, intercept, rvalue, pvalue,stderr)= linregress(x_lat, y_maxtemp)
# plt.scatter(x_lat, y_maxtemp)
# plt.title('City Latitude vs Max Temperature')
# plt.xlabel('Latitude')
# plt.ylabel('Max Temperature (K)')
# plt.grid(True)


(slope, intercept, rvalue, pvalue, stderr) = linregress(x_lat, y_humidity)
regress_values = x_lat * slope + intercept
line_eq = "y = " + str(round(slope,2)) + "x + " + str(round(intercept,2))
plt.scatter(x_lat,y_humidity)
plt.plot(x_lat,regress_values,"r-")
plt.annotate(line_eq,(-65,30),fontsize=15,color="red")
plt.title('Southern Hemisphere: City Latitude vs Humidity')
plt.xlabel('Latitude')
plt.ylabel('Humidity')

#plot.xlim(min, max)
plt.xlim(-70,10)
plt.ylim(10,110)
plt.grid(True)
print(f' City latitude vs humidity in Southern Hempispher shows')
print(f' there isn\'t a strong correlation between the two.')
plt.show()

print(f"The r-squared is: {rvalue**2}")<jupyter_output>City latitude vs humidity in Southern Hempispher shows
 there isn't a strong correlation between the two.<jupyter_text>Northern Hemisphere - Cloudiness (%) vs. Latitude Linear Regression<jupyter_code>x_lat=northern_hem_df['Latitude']
y_cloudiness=northern_hem_df['Cloudiness']


# (slope, intercept, rvalue, pvalue,stderr)= linregress(x_lat, y_maxtemp)
# plt.scatter(x_lat, y_maxtemp)
# plt.title('City Latitude vs Max Temperature')
# plt.xlabel('Latitude')
# plt.ylabel('Max Temperature (K)')
# plt.grid(True)


(slope, intercept, rvalue, pvalue, stderr) = linregress(x_lat, y_cloudiness)
regress_values = x_lat * slope + intercept
line_eq = "y = " + str(round(slope,2)) + "x + " + str(round(intercept,2))
plt.scatter(x_lat,y_cloudiness)
plt.plot(x_lat,regress_values,"r-")
plt.annotate(line_eq,(10,240),fontsize=15,color="red")
plt.title('Northern Hemisphere: City Latitude vs Cloudiness (%) ')
plt.xlabel('Latitude')
plt.ylabel('Cloudiness')
print(f"The r-squared is: {rvalue**2}")

plt.grid(True)
print( f' There is not strong correlation between city latitude and cloudiness.')
print(f' I do not know why this plot would not show bigger.')
plt.show()<jupyter_output>The r-squared is: 0.07644413800294053
 There is not strong correlation between city latitude and cloudiness.
 I do not know why this plot would not show bigger.<jupyter_text>Southern Hemisphere - Cloudiness (%) vs. Latitude Linear Regression<jupyter_code>x_lat=southern_hem_df['Latitude']
y_cloudiness=southern_hem_df['Humidity']


# (slope, intercept, rvalue, pvalue,stderr)= linregress(x_lat, y_maxtemp)
# plt.scatter(x_lat, y_maxtemp)
# plt.title('City Latitude vs Max Temperature')
# plt.xlabel('Latitude')
# plt.ylabel('Max Temperature (K)')
# plt.grid(True)


(slope, intercept, rvalue, pvalue, stderr) = linregress(x_lat, y_cloudiness)
regress_values = x_lat * slope + intercept
line_eq = "y = " + str(round(slope,2)) + "x + " + str(round(intercept,2))
plt.scatter(x_lat,y_cloudiness)
plt.plot(x_lat,regress_values,"r-")
plt.annotate(line_eq,(-75,50),fontsize=15,color="red")
plt.title('Southern Hemisphere: City Latitude vs Cloudiness')
plt.xlabel('Latitude')
plt.ylabel('Cloudiness')
print(f"The r-squared is: {rvalue**2}")
#plot.xlim(min, max)
plt.xlim(-70,10)
plt.ylim(10,120)
plt.grid(True)
print(f' There appears to be more correlation in the Southern Hempisphere')
print(f' for city latitude compared to cloudiness.')
plt.show()<jupyter_output>The r-squared is: 0.18029519276037584
 There appears to be more correlation in the Southern Hempisphere
 for city latitude compared to cloudiness.<jupyter_text>Northern Hemisphere - Wind Speed (mph) vs. Latitude Linear Regression<jupyter_code>x_lat=northern_hem_df['Latitude']
y_wind_speed=northern_hem_df['Wind Speed']


# (slope, intercept, rvalue, pvalue,stderr)= linregress(x_lat, y_maxtemp)
# plt.scatter(x_lat, y_maxtemp)
# plt.title('City Latitude vs Max Temperature')
# plt.xlabel('Latitude')
# plt.ylabel('Max Temperature (K)')
# plt.grid(True)


(slope, intercept, rvalue, pvalue, stderr) = linregress(x_lat, y_wind_speed)
regress_values = x_lat * slope + intercept
line_eq = "y = " + str(round(slope,2)) + "x + " + str(round(intercept,2))
plt.scatter(x_lat,y_wind_speed)
plt.plot(x_lat,regress_values,"r-")
plt.annotate(line_eq,(0,10),fontsize=15,color="red")
plt.title('Northern Hemisphere: City Latitude vs Wind Speed (mph) ')
plt.xlabel('Latitude')
plt.ylabel('Wind Speed')
print(f"The r-squared is: {rvalue**2}")
plt.grid(True)

print(f' there doesn\'t appear to be strong correlation between city latitude vs wind speed.')
plt.show()<jupyter_output>The r-squared is: 0.0009570132607095526
 there doesn't appear to be strong correlation between city latitude vs wind speed.<jupyter_text>Southern Hemisphere - Wind Speed (mph) vs. Latitude Linear Regression<jupyter_code>x_lat=southern_hem_df['Latitude']
y_wind_speed=southern_hem_df['Wind Speed']


# (slope, intercept, rvalue, pvalue,stderr)= linregress(x_lat, y_maxtemp)
# plt.scatter(x_lat, y_maxtemp)
# plt.title('City Latitude vs Max Temperature')
# plt.xlabel('Latitude')
# plt.ylabel('Max Temperature (K)')
# plt.grid(True)


(slope, intercept, rvalue, pvalue, stderr) = linregress(x_lat, y_wind_speed)
regress_values = x_lat * slope + intercept
line_eq = "y = " + str(round(slope,2)) + "x + " + str(round(intercept,2))
plt.scatter(x_lat,y_wind_speed)
plt.plot(x_lat,regress_values,"r-")
plt.annotate(line_eq,(-65,10),fontsize=15,color="red")
plt.title('Southern Hemisphere: City Latitude vs Wind Speed (mph)')
plt.xlabel('Latitude')
plt.ylabel('Wind Speed (mph)')
print(f"The r-squared is: {rvalue**2}")
#plot.xlim(min, max)
#plt.xlim(-70,10)
#plt.ylim(10,110)
plt.grid(True)
print(f' there doesn\'t appear to be strong correlation between city latitude vs wind speed.')
plt.show()<jupyter_output>The r-squared is: 0.04368842247720583
 there doesn't appear to be strong correlation between city latitude vs wind speed.
{'fraction_non_alphanumeric': 0.11905249784844883, 'fraction_numerical': 0.025613704356378837, 'mean_word_length': 5.4487315010570825, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 68, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '18', 'dir': 'jupyter-structured-clean-dedup', 'id': '148360', 'license': 'ADSL', 'n_tokens_mistral': 9215, 'n_tokens_neox': 8362, 'n_words': 2329, 'path': 'WeatherPy/WeatherPy.ipynb', 'repo_name': 'JohnMowry77/python_api_challenge', 'size': '24401'}