class_docstr: DataFile class for NCF. Iterator to read data from a csv file.
  Data must be sorted by user. Includes utilities for loading user data from
  file, formatting it and returning a Pandas dataframe.
class_docstr_tok: ["DataFile","class","for","NCF",".","Iterator","to","read","data","from","a","csv","file",".","Data","must","be","sorted","by","user",".","Includes","utilities","for","loading","user","data","from","file",",","formatting","it","and","returning","a","Pandas","dataframe","."]
docstr: Constructor
  
  Args:
      filename (str): Path to file to be processed.
      col_user (str): User column name.
      col_item (str): Item column name.
      col_rating (str): Rating column name.
      col_test_batch (str): Test batch column name.
      binary (bool): If true, set rating > 0 to rating = 1.
docstr_tok: ["Constructor","Args",":","filename","(","str",")",":","Path","to","file","to","be","processed",".","col_user","(","str",")",":","User","column","name",".","col_item","(","str",")",":","Item","column","name",".","col_rating","(","str",")",":","Rating","column","name",".","col_test_batch","(","str",")",":","Test","batch","column","name",".","binary","(","bool",")",":","If","true",",","set","rating",">","0","to","rating","=","1","."]
code: def __init__(
      self,
      filename,
      col_user,
      col_item,
      col_rating,
      col_test_batch=None,
      binary=True,
  ):
      """Constructor
  
      Args:
          filename (str): Path to file to be processed.
          col_user (str): User column name.
          col_item (str): Item column name.
          col_rating (str): Rating column name.
          col_test_batch (str): Test batch column name.
          binary (bool): If true, set rating > 0 to rating = 1.
      """
      self.filename = filename
      self.col_user = col_user
      self.col_item = col_item
      self.col_rating = col_rating
      self.col_test_batch = col_test_batch
      self.expected_fields = [
          self.col_user,
          self.col_item,
          self.col_rating,
      ]
      if self.col_test_batch is not None:
          self.expected_fields.append(self.col_test_batch)
      self.binary = binary
      self._init_data()
      self.id2user = {self.user2id[k]: k for k in self.user2id}
      self.id2item = {self.item2id[k]: k for k in self.item2id}
  
imports: import os
  from collections import OrderedDict
  import random
  import numpy
  import pandas
  import csv
  import logging
  from tqdm import tqdm
  from recommenders.utils.constants import DEFAULT_ITEM_COL, DEFAULT_USER_COL, DEFAULT_RATING_COL
label_desc: Use image node_id 1 to create a new DataFile object  with example: obj = DataFile(filename, col_user, col_item, col_rating, col_test_batch, binary)