Re: Untitled

From Sloppy Dolphin, 3 Months ago, written in Plain Text, viewed 67 times. This paste is a reply to Untitled from Silly Hog - view diff
URL http://codebin.org/view/34113619 Embed
Download Paste or View Raw
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3.  
  4. import sys
  5. import getopt
  6.  
  7. import pandas as pd
  8.  
  9. if __name__ == "__main__":
  10.  
  11.     # Задаём определения входных параметров
  12.     unixOptions = "s:e:" # напишите код
  13.     gnuOptions = ["start_dt=", "end_dt="] # напишите код
  14.  
  15.     # Читаем входные параметры
  16.     fullCmdArguments = sys.argv
  17.     argumentList = fullCmdArguments[1:]
  18.     try:  
  19.         arguments, values = getopt.getopt(argumentList, unixOptions, gnuOptions)
  20.     except getopt.error as err:  
  21.         print(str(err))
  22.         sys.exit(2)
  23.  
  24.     # Обрабатываем входные параметры
  25.     regions = 'Germany,France,Russia'.split(',')
  26.     for currentArgument, currentValue in arguments:  
  27.         if currentArgument in ("-r", "--regions"): # ваш код здесь
  28.             regions = currentValue.split(',') # ваш код здесь
  29.  
  30.     urbanization = pd.read_csv('/datasets/urbanization.csv')
  31.  
  32.     # Фильтруем и определяем максимальный уровень урбанизации
  33.     urbanization = urbanization.query('Entity in @regions')
  34.     urbanization = urbanization.groupby(regions).agg({'Urban': 'max'}) # ваш код
  35.  
  36.     print(urbanization)

Reply to "Re: Untitled"

Here you can reply to the paste above