1# credit to Stack Overflow user in the source link
2
3from tabulate import tabulate
4import pandas as pd
5
6df = pd.DataFrame({'col_two' : [0.0001, 1e-005 , 1e-006, 1e-007],
7 'column_3' : ['ABCD', 'ABCD', 'long string', 'ABCD']})
8print(tabulate(df, headers='keys', tablefmt='psql'))
9
10+----+-----------+-------------+
11| | col_two | column_3 |
12|----+-----------+-------------|
13| 0 | 0.0001 | ABCD |
14| 1 | 1e-05 | ABCD |
15| 2 | 1e-06 | long string |
16| 3 | 1e-07 | ABCD |
17+----+-----------+-------------+