-1

I wanted to construct a table in the Below format using python.

Edit : Sorry for not writing the question properly

I have used PrettyTable

t = PrettyTable() t.field_names =["TestCase Name","Avg Response", "Response time "] But for Spanning the columns R1 and R2 I am struggling.

I am trying to add data to column Testcase Name,but TestCase Name is again adding as a column at the end. I am trying to do using the Prettytable library t.add_column("TestCase Name", ['', 'S-1', 'S-2'])

| Test Case Name |  Avg Response  | Response time  |
+----------------+----------------+----------------+
|                | R1   |  R2     |  R1   |   R2   |
+----------------+------+---------+-------+--------+
|  S-1           |      |         |       |        |
+----------------+------+---------+-------+--------+
|  S-2           |      |         |       |        |
+--------------------------------------------------+```

Thank You

2 Answers2

0

If you want to display the table in the terminal/console. See https://pypi.org/project/tabulate/ or https://pypi.org/project/prettytable/

Although, I’ve only ever used tabulate so can only recommend that one.

If you want proper data visualisation reports with complex data structures. I’d probably go with using NumPy and/or Pandas.

HaffiM
  • 31
  • 1
  • 4
0

yeah have a look at https://pypi.org/project/tabulate/

and if you wanna use it just do

pip install tabulate

in cmd

Jai Sloper
  • 78
  • 5