示例#1
0
文件: main.py 项目: skvizur/SV02
import psycopg2
import getpass
import pprint
import random as r
import FOLL as F
import pandas as pd
import string
import itertools

#GRUNNUR AD MOVIES TÖFLU
movie_table = F.movies_table('movies.dat')

#GRUNNUR AD RATING TÖFLLU					
rating_table = F.ratings_table('ratings.dat')

#GRUNNUR AÐ NOTENDATÖFLU
user_table = F.username_table('users.dat')

#GRUNNUR AÐ GENRES TÖFLU
movieid_genresid = F.genres_table('movies.dat')


#TENGJUMST GAGNAGRUNNI

host = 'localhost'
dbname = 'movies'

username = '******' #input('User name for {}.{}: '.format(host,dbname)) 
pw = '1313' #getpass.getpass()

conn_string = "host='{}' dbname='{}' user='******' password='******'".format(host, dbname, username, pw)
示例#2
0
import csv
import string
import numpy as np
import pandas as pd
from collections import Counter
import FOLL as F

#Skilgreinum numpy fylkja breytur fyrir völdu launaflokkana okkar, allar breytur innihalda ár og svo laun.
avg_year_income_overall = F.data_to_numpy_overall('SALLS.csv')
avg_year_income_KK,count_years_KK = F.data_to_numpy('VKK.csv')
avg_year_income_KVK,count_years_KVK = F.data_to_numpy('VKVK.csv')

#Skilgreinum numpy fylkja breytur fyrir völdu launaflokkana okkar, nú miðað við vísitölu neysluverðs.
income_basedOnIndex_KK = F.index_function('visitolur.CSV',avg_year_income_KK,count_years_KK)
income_basedOnIndex_KVK = F.index_function('visitolur.CSV', avg_year_income_KVK,count_years_KK)
income_basedOnIndex_overall = F.index_function('visitolur.CSV', avg_year_income_overall, count_years_KK)

#Skilgreinum numpy fylkja breytur fyrir völdu launaflokkana okkar, en breyturnar innihalda raunverulega hækkun á launum milli ára.
real_increase_overall =F.real_increase(avg_year_income_overall,income_basedOnIndex_overall,count_years_KK)
real_increase_KK = F.real_increase(avg_year_income_KK, income_basedOnIndex_KK,count_years_KK)
real_increase_KVK = F.real_increase(avg_year_income_KVK, income_basedOnIndex_KVK,count_years_KK)

#Setjum raunhækkanir nú í pandas töflu sem sýnir niðurstöðurnar best.

#Skilgreinum flokkana í dálkunum
A = 'Raunhaekkun á launum stjórnenda alls(KK/KVK)'
B = 'Raunhaekkun á launum KK í verkfr. stöðu'
C = 'Raunhaekkun á launum KVK í verkfr. stöðu'

columns = [A,B,C]
index = [avg_year_income_KK[:,0]] #Náum í öll árin úr þessari numpy breytu, hefðum getað valið nánast hvaða numpy breytu
示例#3
0
文件: main.py 项目: skvizur/SV03
if BMI < 18.5:
	print("You have to gain a lot of weight to be obese!")
elif 18.5 <= BMI <= 24:
	print("You are in the normal weight range, that is good!")
elif 24 < BMI <= 25:
	print("You are in the normal weight range, but you have to be careful...")
elif 25 < BMI < 30:
	print("You are overweight.")
else:
	print("You are obese, get help!")

print("\n")

if sex == 'Female':
	ave_bmi_country = F.ave_bmi_kvk_country(country, cursor)[0][0]
	ave_bmi_country = float(format(ave_bmi_country, '.2f'))
	ave_bmi_world = F.ave_bmi_kvk_world(cursor)[0][0]
	ave_bmi_world = float(format(ave_bmi_world, '.2f'))
elif sex == 'Male':
	ave_bmi_country = F.ave_bmi_kk_country(country, cursor)[0][0]
	ave_bmi_country = float(format(ave_bmi_country, '.2f'))
	ave_bmi_world = F.ave_bmi_kk_world(cursor)[0][0]
	ave_bmi_world = float(format(ave_bmi_world, '.2f'))

print("The average BMI for {} in {} is {}".format(sex, country, ave_bmi_country))
print("The average BMI for {} in the world is {}".format(sex, ave_bmi_world))

if ave_bmi_world > BMI:
	prosenta = (BMI / ave_bmi_world)*100
	prosenta = format(prosenta, '.2f')