(csv_filename, meta_filename=None, header=True, discrete=None)
return data, discrete_columns
Read a csv file.
Read a csv file.
Read a csv file .
def read_csv(csv_filename, meta_filename=None, header=True, discrete=None):
    """Read a csv file."""
    data = pd.read_csv(csv_filename, header='infer' if header else None)

    if meta_filename:
        with open(meta_filename) as meta_file:
            metadata = json.load(meta_file)

        discrete_columns = [
            column['name']
            for column in metadata['columns']
            if column['type'] != 'continuous'
        ]

    elif discrete:
        discrete_columns = discrete.split(',')
        if not header:
            discrete_columns = [int(i) for i in discrete_columns]

    else:
        discrete_columns = []

    return data, discrete_columns
def read_csv ( csv_filename , meta_filename = None , header = True , discrete = None ) : data = pd . read_csv ( csv_filename , header = 'infer' if header else None ) if meta_filename : with open ( meta_filename ) as meta_file : metadata = json . load ( meta_file ) discrete_columns = [ column [ 'name' ] for column in metadata [ 'columns' ] if column [ 'type' ] != 'continuous' ] elif discrete : discrete_columns = discrete . split ( ',' ) if not header : discrete_columns = [ int ( i ) for i in discrete_columns ] else : discrete_columns = [ ] return data , discrete_columns