#+BEGIN_SRC python :results raw import pandas as pd import numpy as np from tabulate import tabulate df = pd.DataFrame(np.random.random((4,3)), columns=['A','B','C']) print("foo") return(tabulate(df, headers="keys", tablefmt="orgtbl")) #+END_SRC #+RESULTS: | | A | B | C | |---+----------+----------+----------| | 0 | 0.754799 | 0.492722 | 0.144595 | | 1 | 0.198475 | 0.417721 | 0.083459 | | 2 | 0.645011 | 0.444857 | 0.278874 | | 3 | 0.314883 | 0.7521 | 0.789418 | And ~:session~ version: #+BEGIN_SRC python :results raw :session foo import pandas as pd import numpy as np from tabulate import tabulate df = pd.DataFrame(np.random.random((4,3)), columns=['A','B','C']) print("foo") tabulate(df, headers="keys" ,headers="keys",tablefmt="orgtbl") #+END_SRC #+RESULTS: | | A | B | C | |---+-----------+-----------+----------| | 0 | 0.732506 | 0.508531 | 0.651031 | | 1 | 0.0187486 | 0.467498 | 0.391717 | | 2 | 0.231897 | 0.0988542 | 0.170519 | | 3 | 0.742887 | 0.10542 | 0.271825 |