def main(train): data = Read_csv(train).get() name_house = ["Hufflepuff", "Slytherin", "Ravenclaw", "Gryffindor"] note_house, name_mat = list(), list() name_mat = fill_mat(data) note_house = fill_note_house(data) histo(note_house, name_mat, name_house)
def main(train): data = Read_csv(train).get() name_mat = fill_mat(data) note = fill_note(data, len(data[0])) ret_data = all_calcul(note) write(name_mat, ret_data) bonus(name_mat, data)
def __init__(self, _filepath, _account): self.names = access_database.get_column_in_table('name', 'accounts') self.name = _account self.id = access_database.get_id_where_column('accounts', 'name', _account) self.csv = Read_csv(_filepath) pass
def main(train): data = Read_csv(train).get() data = check_empty(data) name_house = ["Hufflepuff", "Slytherin", "Ravenclaw", "Gryffindor"] note_house, name_mat = list(), list() name_mat = fill_mat(data) note_house = fill_note_house(data) scatter_plt(note_house, name_house, name_mat)
class Product_values: def __init__(self, _filepath): self.data_str = None self.account_id = None self.csv = Read_csv(_filepath) self.product = Product() pass def from_account(self, _account): self.csv.read_depot(_account) self.data_str = self.csv.date_str self.account_id = 1 # this method # reads ids of products with wkn/isin, set product_values with date, value, account_id def update_product_values(self): insert_product_value(self.data_str, 21.5, 518.63, 23.43, self.account_id, self.product.id) pass
def main(note_csv, theta_csv): data = csv.reader(open(theta_csv, "r")) theta = np.array([0.0]*4*10).reshape(4,10) for i, row in enumerate(data): for k in range(len(theta[i])): theta[i][k] = float(row[k]) data = csv.reader(open(theta_csv, "r")) data = Read_csv(note_csv).get() note = get_note(data) note = get_feat(note) note = check_empty(note) note = norme(note) note = np.array(note) test_theta(note, theta)
class GitRepoSpider(scrapy.Spider): name = "Github" urls = Read_csv.repo_github() start_urls = [] for url in urls: start_urls.append("https://github.com/" + url) def parse(self, response): f = open("results.txt", "a+") for paragraph in response.css('div.Box-body p'): for a in paragraph.css('a'): title = a.css("::attr(href)").extract_first() travis = re.findall("travis", title) if (len(travis) > 0): f.write(response.url.replace(',', '') + " true\n") time.sleep(2) f.close()
def main(train): index = [2, 3, 4, 5, 6, 7, 8, 11, 12] data = Read_csv(train).get() data = check_empty(data, index) note, house = list(), list() note, house = get_note(data) note = get_feat(note) note = [[float(y) for y in x] for x in note] n_norme, diviseur = norme(note) tmp = int(len(n_norme) * 0.7) note_train = np.array(n_norme[:tmp]) note_test = np.array(n_norme[tmp:]) house_train = np.array(house[:tmp]) house_test = np.array(house[tmp:]) theta = train_theta(note_train, house_train, diviseur) test_theta(note_test, house_test, theta) save_theta(theta) print("Train successfully")
def __init__(self, _filepath): self.data_str = None self.account_id = None self.csv = Read_csv(_filepath) self.product = Product() pass