I would like to print a table on the terminal and for that I use the tabulate package but I have extra return chariot '\n'. How can I remove them?
import pandas as pd
from tabulate import tabulate
df = pd.DataFrame({'schools' : ['Harvard', 'MIT', 'UCal', 'Cornell'],
'Faculty' : ['CS', 'Psychology', 'Biology', 'BioInformatics']})
print(tabulate(df,headers='keys',tablefmt='psql'))
Result
('+----+-----------+----------------+\n'
'| | schools | Faculty |\n'
'|----+-----------+----------------|\n'
'| 0 | Harvard | CS |\n'
'| 1 | MIT | Psychology |\n'
'| 2 | UCal | Biology |\n'
'| 3 | Cornell | BioInformatics |\n'
'+----+-----------+----------------+')