def loadCategory_id(catalog): file = cf.data_dir + 'category-id.csv' input_file = csv.DictReader(open(file, encoding='utf-8', errors='ignore'), delimiter='\t') for category in input_file: sub_catalog = {'id': category['id'], 'name': category['name']} model.addCategory(catalog, sub_catalog)
def loadCategoryID(catalog): categoryfile = cf.data_dir + 'category-id.csv' input_file = csv.DictReader(open(categoryfile, encoding='utf-8'), delimiter='\t') print(input_file) for categ in input_file: model.addCategory(catalog, categ)
def loadData(catalog): delta_time = -1.0 delta_memory = -1.0 tracemalloc.start() start_time = getTime() start_memory = getMemory() categoriesfile = cf.data_dir + "category-id.csv" i_file = csv.DictReader(open(categoriesfile, encoding='utf-8'), delimiter='\t') for category in i_file: model.addCategory(catalog, category) videosfile = cf.data_dir + 'videos-large.csv' input_file = csv.DictReader(open(videosfile, encoding='utf-8')) for video in input_file: video["trending_date"] = datetime.strptime(video["trending_date"], "%y.%d.%m").date() model.addVideo(catalog, video) stop_memory = getMemory() stop_time = getTime() tracemalloc.stop() delta_time = stop_time - start_time delta_memory = deltaMemory(start_memory, stop_memory) return delta_time, delta_memory
def loadCategories(catalog): categoriesfile = cf.data_dir + 'videos/category-id.csv' input_file = csv.DictReader(open(categoriesfile, encoding='utf-8'), delimiter='\t') for category in input_file: model.addCategory(catalog, category)
def loadCategory(catalog): categoryfile = cf.data_dir + 'category-id.csv' dialect = csv.excel() dialect.delimiter = "\t" input_file = csv.DictReader(open(categoryfile, encoding='utf-8'), dialect=dialect) for category in input_file: model.addCategory(catalog, category)
def loadCategories(catalog): """ Carga todas las categorias del archivo y las agrega a la lista de categorias """ categoriesfile = cf.data_dir + 'category-id.csv' input_file = csv.DictReader(open(categoriesfile)) for category in input_file: model.addCategory(catalog, category)
def loadCategory(catalog): """ Carga las categorias de videos y los agrega a la lista de categorías """ categoryfile = cf.data_dir + 'videos/category-id.csv' input_file = csv.DictReader(open(categoryfile, encoding='utf-8')) for category in input_file: model.addCategory(catalog, category)
def loadCategory(catalog): """ Carga todos los tags del archivo y los agrega a la lista de tags """ categoryfile = cf.data_dir + 'Videos/category-id.csv' input_file = csv.DictReader(open(categoryfile, encoding='utf-8')) for category in input_file: model.addCategory(catalog, category)
def loadCategories(catalog): """ Carga todas las categorias del archivo e indica al modelo que los adicione al catalogo """ categoriesfile = cf.data_dir + 'Samples/category-id.csv' inputfile = csv.DictReader(open(categoriesfile, encoding='utf-8')) for category in inputfile: model.addCategory(catalog, category)
def loadCategories(catalog): """ Carga todos las categorias del archivo y los agrega a la lista de categorias """ categoriasfile = cf.data_dir + 'videos/category-id.csv' input_file = csv.DictReader(open(categoriasfile, encoding='utf-8'), delimiter='\t') for cat in input_file: model.addCategory(catalog, cat)
def categoryId(catalog): """ Carga todas categorias del archivo y los agrega a la lista de categorias """ video_category_id = cf.data_dir + 'videos/category-id.csv' input_file = csv.DictReader(open(video_category_id, encoding='utf-8'), delimiter="\t") for category in input_file: model.addCategory(catalog, category)
def loadCategory(catalog): """ Carga las categorías del archivo. Por cada categoría se indica al modelo que debe adicionarla al catálogo """ categoryidfile = cf.data_dir + 'videos/category-id.csv' input_file = csv.DictReader(open(categoryidfile, encoding='utf-8'), delimiter='\t') for category in input_file: model.addCategory(catalog, category)
def loadCategoryIds(catalog): """ Carga todos los category ids del archivo y los agrega a la lista de category ids """ categoriesFiles = cf.data_dir + "Videos/category-id.csv" input_file = csv.DictReader(open(categoriesFiles, encoding="utf-8"), delimiter='\t') for category in input_file: model.addCategory(catalog, category)
def loadCategories(catalog): """ Carga todas los categories del archivo y las agrega a la lista de categories """ category_file=cf.data_dir +"category-id.csv" input_file=csv.DictReader(open(category_file, encoding='utf-8'), delimiter='\t') for category in input_file: model.addCategory(catalog, category)
def loadCategories(catalog): file_name = cf.data_dir + "category-id.csv" input_file = csv.DictReader(open(file_name, encoding="utf-8"), delimiter="\t") i = 0 for categoria in input_file: model.addCategory(catalog, categoria) i += 1 print("Cantidad de categorias cargadas: ", i)
def loadCategory(catalog): categoriesfile = cf.data_dir + 'category-id.csv' input_file = csv.DictReader(open(categoriesfile, encoding='utf-8'), delimiter='\t') categoryList = model.newCategoryList() for category in input_file: cl = model.addCategoryInfo(catalog, category) model.addCategory(categoryList, cl) return categoryList
def loadCategories(catalog): categoryfile = cf.data_dir + 'videos/category-id.csv' input_file = csv.DictReader(open(categoryfile, encoding='utf-8'), delimiter='\t') for cat in input_file: new_cat = {} info = ['id', 'name'] for i in info: new_cat[i] = (str(cat[i]).lower()).replace(' ', '') model.addCategory(catalog, new_cat)
def loadCategories(catalog): tagsfile = cf.data_dir + 'category-id.csv' input_file = csv.DictReader(open(tagsfile, encoding='utf-8')) for category in input_file: Dato = category['id\tname'] Dato2 = Dato.split('\t') Name = Dato2[1].strip() NumberId= Dato2[0] model.addCategory(catalog, Name , NumberId)
def loadCategory(catalog): """ Carga los libros del archivo. Por cada libro se toman sus autores y por cada uno de ellos, se crea en la lista de autores, a dicho autor y una referencia al libro que se esta procesando. """ categoryfile = cf.data_dir + 'videos/category-id.csv' input_file = csv.DictReader(open(categoryfile, encoding='utf-8')) for category in input_file: model.addCategory(catalog, category)
def loadCategories(catalog): """ Carga los videos del archivo. Por cada libro se toman el título, nombre del canal, fecha de trending, país, vistas, likes, dislikes """ videos_file = cf.data_dir + 'videos/category-id.csv' dialect = csv.excel() dialect.delimiter = '\t' input_file = csv.DictReader(open(videos_file, encoding='utf-8'), dialect=dialect) for line in input_file: model.addCategory(catalog, line)
def loadCategory(catalog): """Crea un diccionario con la informacion de la categoria para que sea posteriormente agregado al catalogo en su lista correspondiente""" categoriesfile = cf.data_dir + "category-id.csv" input_file = csv.DictReader(open(categoriesfile, encoding="utf-8")) for category in input_file: category_list = category["id\tname"].split("\t") category["name"] = category_list[1] category["id"] = int(category_list[0]) model.addCategory(catalog, category)
def loadCategories(catalog): """ Carga las categorías del archivo. Por cada categoría su guarda su id y su nombre. """ categoriesfile = cf.data_dir + 'category-id.csv' input_file = csv.DictReader(open(categoriesfile, encoding='utf-8'), delimiter="\t") for category in input_file: categories = {'id': int(category['id']), 'name': category['name']} model.addCategory(catalog, category)
def loadCategory(catalog): """Crea un diccionario con la informacion de la categoria para que sea posteriormente agregado al catalogo en su lista correspondiente""" categoriesfile = cf.data_dir + 'GoodReads/category-id.csv' input_file = csv.DictReader(open(categoriesfile, encoding='utf-8')) for category in input_file: category_list = category['id\tname'].split('\t') category['name'] = category_list[1] category['id'] = int(category_list[0]) model.addCategory(catalog, category)
def loadData(catalog): videosfile = cf.data_dir + 'videos-large.csv' input_file = csv.DictReader(open(videosfile, encoding='utf-8')) for video in input_file: video["trending_date"] = datetime.strptime(video["trending_date"],"%y.%d.%m").date() model.addVideo(catalog, video) categoriesfile = cf.data_dir + "category-id.csv" i_file = csv.DictReader(open(categoriesfile, encoding='utf-8'), delimiter='\t') for category in i_file: model.addCategory(catalog,category)
def loadCategories(catalog): ctfile = cf.data_dir + 'videos/category-id.csv' input_file = csv.DictReader(open(ctfile, encoding='utf-8')) for category in input_file: dic = {} num = split('\D+', category['id\tname']) lista = category['id\tname'].split() palabra = lista[1:] n = "".join(num) p = ' '.join(palabra) dic[p] = n model.addCategory(catalog, dic)
def loadCategory(catalog): categoryfile = cf.data_dir + 'category-id.csv' input_file2 = csv.DictReader(open(categoryfile, encoding='utf-8'),delimiter=('\t')) for category in input_file2: model.addCategory(catalog, category)
def loadCategory(catalog): categoryfile = cf.data_dir + "category-id.csv" input_file = csv.DictReader(open(categoryfile, encoding="utf-8"), delimiter='\t') for category in input_file: model.addCategory(catalog, category)
def loadIDs(catalog): # Carga todos los tags del archivo y los agrega a la lista de tags idsfile = cf.data_dir + 'category-id.csv' input_file = csv.DictReader(open(idsfile, encoding='utf-8')) for id in input_file: model.addCategory(catalog, id)
def loadCategory(catalog): datos_category = cf.data_dir + 'category-id.csv' input_file = csv.DictReader(open(datos_category, encoding='utf-8'), delimiter='\t') for category in input_file: model.addCategory(catalog, category) return None
def loadCategories(catalog): categoryFile = cf.data_dir + 'category-id.csv' inputFile = csv.DictReader(open(categoryFile, encoding="utf-8")) for category in inputFile: model.addCategory(catalog, category) print(category)