#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import getopt
import pandas as pd
if __name__ == "__main__":
# ?????? ??????????? ??????? ??????????
unixOptions = "s:e:" # ???????? ???
gnuOptions = ["start_dt=", "end_dt="] # ???????? ???
# ?????? ??????? ?????????
fullCmdArguments = sys.argv
argumentList = fullCmdArguments[1:]
try:
arguments, values = getopt.getopt(argumentList, unixOptions, gnuOptions)
except getopt.error as err:
print(str(err))
sys.exit(2)
# ???????????? ??????? ?????????
regions = 'Germany,France,Russia'.split(',')
for currentArgument, currentValue in arguments:
if currentArgument in ("-r", "--regions"): # ??? ??? ?????
regions = currentValue.split(',') # ??? ??? ?????
urbanization = pd.read_csv('/datasets/urbanization.csv')
# ????????? ? ?????????? ???????????? ??????? ???????????
urbanization = urbanization.query('Entity in @regions')
urbanization = urbanization.groupby(regions).agg({'Urban': 'max'}) # ??? ???
print(urbanization)
Re: Untitled
From Sloppy Dolphin, 6 Months ago, written in Plain Text, viewed 104 times.
This paste is a reply to Untitled from Silly Hog
- go back
URL http://codebin.org/view/34113619/diff
Embed
Viewing differences between Untitled and Re: Untitled
— Expand Paste to full width of browser