def dataset(headers, data, encoding=None):
 dataset = tablib.Dataset()
 if headers:
  dataset.headers = encode_row(headers, encoding)
 for row in data:
  dataset.append(encode_row(row, encoding))
 return dataset

def dataset ( headers , data , encoding = None ) : dataset = tablib . Dataset ( ) if headers : dataset . headers = encode_row ( headers , encoding ) for row in data : dataset . append ( encode_row ( row , encoding ) ) return dataset
dataset -> dataset object return a dataset object for a csv or excel document .