Untitled

From Stained Sheep, 1 Year ago, written in PHP, viewed 303 times. This paste will cross the great divide in 1 Second.
URL http://codebin.org/view/4555e7b6 Embed
Download Paste or View Raw
  1. import pandas
  2. data = pandas.read_csv('crops_usa.csv')
  3.  
  4. acres = list(data['Acres'])
  5. production = list(data['Production'])
  6. years = list(data['Year'])
  7.  
  8. acres_usa = []
  9. production_usa = []
  10.  
  11. for year in range(1980, 2020):
  12.     acres_one_year = []
  13.     production_one_year = []
  14.     for index in range(len(data)):
  15.         if years[index] == year:
  16.             acres_one_year.append(acres[index])
  17.             production_one_year.append(production[index])
  18.     acres_usa.append(sum(acres_one_year))
  19.     production_usa.append(sum(production_one_year))
  20.  
  21. yield_usa = []
  22.  
  23. for index in range(len(production_usa)):
  24.     yield_usa.append(production_usa[index] / acres_usa[index])
  25.    
  26. years_numbers = list(range(1980, 2020))
  27.    
  28. error_acres = [] # ваш код здесь
  29.  
  30. for index in range(len(production_usa)):
  31.     error_acres.append(production_usa[index] - (acres_usa[index] * yield_usa[index - 1]))
  32.  
  33. # print(error_acres)
  34.                      
  35. import seaborn
  36.                        
  37. seaborn.barplot(x = years_numbers[1:], y = error_acres)

Reply to "Untitled"

Here you can reply to the paste above