Advertisement
Vitaliy_Novichikhin

7.8.1 нереальные значения планируемого объёма урожая

Feb 4th, 2022
1,766
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. #7.8.1 найти значения планируемого объёма урожая отталкиваясь от посевной площади
  2. import pandas
  3. data = pandas.read_csv('crops_usa.csv')
  4.  
  5. acres = list(data['Acres'])
  6. production = list(data['Production'])
  7. years = list(data['Year'])
  8.  
  9. acres_usa = []
  10. production_usa = []
  11.  
  12. for year in range(1980, 2020):
  13.     acres_one_year = []
  14.     production_one_year = []
  15.     for index in range(len(data)):
  16.         if years[index] == year:
  17.             acres_one_year.append(acres[index])
  18.             production_one_year.append(production[index])
  19.     acres_usa.append(sum(acres_one_year))
  20.     production_usa.append(sum(production_one_year))
  21.  
  22. yield_usa = []
  23.  
  24. for index in range(len(production_usa)):
  25.     yield_usa.append(production_usa[index] / acres_usa[index])
  26.  
  27. predict_acres = []
  28.  
  29. for i in range(1, len(acres_usa)):
  30.     predict_acres.append(acres_usa[i] * yield_usa[i]) # ваш код здесь
  31.  
  32. print(predict_acres)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement