<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Florida's Water Budget
The Impact of Humans & Nature on Freshwater Sources
This activity displays the water use, rainfall and water levels in Florida counties. You can use the code to change the charts and graphs below. Try to find the significance between the data.
Sources include (waterdata.usgs.gov/fl/nwis/current/?type=precip)
and (www.sjrwmd.com)
Step1:  PART 1
Step2:  This table shows the top 10 water consuming counties, the population, the amount of the population that is connected to public water (PublicSupply), and the total water used by each county.
Step3:  Most Water Consuming Counties in Florida
Step4:  Try to change the histogram so that it displays the County and the Population Total. (Right now it is displaying County and Water Use Total)
PART 2
Step5:  Rainfall in February 2005 (Inches)
Step6:  Try to change the histogram to display the data in decending order.
Rainfall in July 2005 (Inches)
Step7:  PART 3
Step8:  Water Level in February
Step9:  Water Level in July
<ASSISTANT_TASK:>
Python Code:
# Import modules that contain functions we need
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
# Our data is a table and is defined as the word 'data'.
# 'data' is set equal to the .csv file that is read by the pandas function.
# The .csv file must be in the same disrectory as the program.
#data = pd.read_csv("Public Water Supply FL 2010.csv")
# You can also use external links to .xls, .csv, or .txt files and would import useing the same funtion but replaceing the
# file name with the webpage. For example:
data = pd.read_csv("https://gist.githubusercontent.com/GoodmanSciences/9d53d0874281a61354cc8a9a962cb926/raw/e379c22e667aa309cc02048bd2b7bb31ce540d60/Public%2520Water%2520Supply%2520FL%25202010.csv")
Explanation: Florida's Water Budget
The Impact of Humans & Nature on Freshwater Sources
This activity displays the water use, rainfall and water levels in Florida counties. You can use the code to change the charts and graphs below. Try to find the significance between the data.
Sources include (waterdata.usgs.gov/fl/nwis/current/?type=precip)
and (www.sjrwmd.com)
End of explanation
# displays the first few rows of the table
data.head(4)
# Set variables for scatter plot
x = data.Population
y = data.WaterUsed
fig = plt.figure(figsize=(15, 6))
plt.scatter(x,y)
plt.xlim(0,3000000)
plt.ylim(0,350)
plt.title('The Relationship Between Population and How Much Water a County Consumes Each Year')
plt.xlabel('Population (individuals)')
plt.ylabel('Water Used (million gallons)')
# This actually shows the plot
plt.show()
# Creates a new dataset for County
place = data.groupby("County", as_index = False).sum()
Explanation: PART 1: Water Used by Florida Counties in 2010
This table displays the County name, its population, the puplic water supply for that county, and the total water used by that county.
End of explanation
# Orginizes by County with the highest water usage in decending order
#Only displays the top 10 highestest water consuming counties by putting .head(10)
mostwater = place.sort_values(by="WaterUsed", ascending = False).head(10)
mostwater
Explanation: This table shows the top 10 water consuming counties, the population, the amount of the population that is connected to public water (PublicSupply), and the total water used by each county.
End of explanation
# Displays a histogram of the top 10 water consuming counties in ascending order
mostwater.sort_values(by="WaterUsed", ascending=True).plot(x="County", y="WaterUsed", kind="barh", title="Top 10 Water Consuming Counties", legend=False);
Explanation: Most Water Consuming Counties in Florida
End of explanation
# Imports more csv files locally
#feb = pd.read_csv("Feb2005_FL_rainfall.csv")
#july = pd.read_csv("July2005_FL_rainfall.csv")
# Imports more csv files from the web
july = pd.read_csv("https://gist.githubusercontent.com/GoodmanSciences/354fa30fb1e506c055621b893b26ebe8/raw/523e483ae4534c9432f91e5d5b7f9fb0356e95e1/Rainfall%2520FL%2520Jul2005.csv")
feb = pd.read_csv("https://gist.githubusercontent.com/GoodmanSciences/7088ff6b7b8e915a87ee987f3b767641/raw/a76a0dd975f95e6c0c5e6ee810e6f6e66faeca9b/Rainfall%2520FL%2520Feb2005.csv")
Explanation: Try to change the histogram so that it displays the County and the Population Total. (Right now it is displaying County and Water Use Total)
PART 2:  Rainfall Additions to the Water Supply
End of explanation
feb.head()
# Plots rainfall form ascending order
feb.sort_values(by="Monthly Total", ascending=True).plot(x="County", y="Monthly Total", kind="barh", title="Rainfall in February (Inches)", legend=False);
Explanation: Rainfall in February 2005 (Inches)
End of explanation
july.head()
july.sort_values(by="Monthly Total", ascending=True).plot(x="County", y="Monthly Total", kind="barh", title="Rainfall in July (Inches)", legend=False);
from IPython.display import Image
from IPython.core.display import HTML 
Image(url= 'https://preview.ibb.co/g7Z6sa/Average_Monthly_Water_Consumption.png')
Image(url= 'https://floridamaps.files.wordpress.com/2015/03/florida-counties.jpg')
#Double-click to make this image GINORMOUS
Explanation: Try to change the histogram to display the data in decending order.
Rainfall in July 2005 (Inches)
End of explanation
# Imports another csv file locally
#level = pd.read_csv("Lake Apopka Waterlevel 2005.csv")
# Imports another csv file from the web
level = pd.read_csv("https://gist.githubusercontent.com/GoodmanSciences/e63b6cb68cd6ef5235dc8c113ea9995a/raw/39139535f7ef05057ecce1126ea336ca7bcfb879/Lake%2520Apopka%2520Waterlevel%25202005.csv")
# Sets Date as index
lev2 = level.set_index("Date")
Explanation: PART 3: Monitoring Lake Apopka a Freshwater Source for Agriculture
End of explanation
# Displays only Feb 1st through the 28th
lev2.loc["2/1/2005":"2/28/2005", :]
Explanation: Water Level in February
End of explanation
# Displays only July 1st through the 7th
lev2.loc["7/1/2005":"7/7/2005", :]
# Plot of all values in level dataset
level.plot('Date', 'Water Level')
Image(url= 'http://www.floridacountiesmap.com/graphics/orange.gif')
Explanation: Water Level in July
End of explanation
<END_TASK>