#NEWLINE# def create( self , **kwargs ) : #NEWLINE# #INDENT# uploaded_file = self . validated_data [ 'file' ] #NEWLINE# batch_file = BatchFile ( deleted = False , file = uploaded_file ) #NEWLINE# delimiter = get_delimiter ( uploaded_file . name ) #NEWLINE# df = pd . DataFrame ( pd . read_csv ( uploaded_file , sep = delimiter ) ) #NEWLINE# df = df . where ( pd . notnull ( df ) , None ) #NEWLINE# column_headers = list ( kwargs . columns . values ) #NEWLINE# num_rows = len ( df . index ) #NEWLINE# first_row = dict ( zip ( column_headers , list ( df . values [ 0 ] ) ) ) #NEWLINE# batch_file . number_of_rows = num_rows #NEWLINE# batch_file . column_headers = column_headers #NEWLINE# batch_file . first_row = first_row #NEWLINE# batch_file . name = uploaded_file . name #NEWLINE# batch_file . save ( ) #NEWLINE# return batch_file