def prepare(mode, inp, out): """ Transform the given dataset file """ if mode == 'help': # log("Cognito CLI", color="blue", figlet=True) click.echo(custom_fig.renderText('cognito')) if mode == 'ml': df = Table(inp) response, encoder = df.generate() click.echo(save_to(out, response, encoder)) if mode == 'report': df = Table(inp) table = PrettyTable([ 'Features', 'Feature Type', 'Outliers', '% of outliers', 'Missing', '%of missing' ]) for col in df.columns(): table.add_row([col, '', '', '', '', '']) click.echo(table)
class Report: def __init__(self, filename): self.data = Table(filename) def generate(self): columns = self.data.columns() table = PrettyTable(columns) print(table)
def prepare(mode, inp, out): """ Transform the given dataset file """ if mode == 'help': # log("Cognito CLI", color="blue", figlet=True) click.echo(custom_fig.renderText('cognito')) if mode == 'prepare': df = Table(inp) response, encoder = df.generate() click.echo(save_to(out, response, encoder)) if mode == 'autoML': df = Table(inp) click.echo(df.total_columns()) if mode == 'report': df = Table(inp) table = PrettyTable([ 'Features', 'Feature Type', 'Outliers', '% of outliers', 'Missing', '%of missing' ]) for col in df.columns(): table.add_row([col, '', '', '', '', '']) click.echo(table) if mode == 'decode': with trange(11) as t: for i in t: t.set_description('C(x) decoding %i' % i) sleep(0.1) click.echo('Completed decoding') click.echo(get_all_files())
def test_table_columns_two(): data = Table(os.path.join(os.path.dirname(__file__), 'data', 'student.csv')) assert data.columns().tolist() == ['sex', 'age', 'Mjob', 'G1']
def test_table_columns_one(): data = Table(os.path.join(os.path.dirname(__file__), 'data', 'cereal.csv')) assert data.columns().tolist() == [ 'name', 'mfr', 'sodium', 'type', 'calories', 'sugars' ]
def test_load_table(): table = Table( os.path.join(os.path.dirname(__file__), 'data', 'Freedman.csv')) print(table.columns())
def test_columns_three(): data = Table( os.path.join(os.path.dirname(__file__), 'data', 'Freedman.csv')) assert data.columns() == [ 'Location', 'population', 'nonwhite', 'density', 'crime' ]