MCPcopy Create free account
hub / github.com/FlyingFeather/DEA-SQL / nice_look_table

Function nice_look_table

data_preprocess.py:444–458  ·  view source on GitHub ↗
(column_names: list, values: list)

Source from the content-addressed store, hash-verified

442
443
444def nice_look_table(column_names: list, values: list):
445 rows = []
446 # Determine the maximum width of each column
447 widths = [max(len(str(value[i])) for value in values + [column_names]) for i in range(len(column_names))]
448
449 # Print the column names
450 header = ''.join(f'{column.rjust(width)} ' for column, width in zip(column_names, widths))
451 # print(header)
452 # Print the values
453 for value in values:
454 row = ''.join(f'{str(v).rjust(width)} ' for v, width in zip(value, widths))
455 rows.append(row)
456 rows = "\n".join(rows)
457 final_output = header + '\n' + rows
458 return final_output
459
460
461def generate_db_prompt_bird_v2(root_dir, dataset, db_id, limit_value=3):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected