ob-ipython
ob-ipython copied to clipboard
pandas dataframe output header is not aligned to column
This is due to ob-ipython removing all leading whitespaces. for example, the output looks like
Name Age Year Cmp Att Yds TD
0 Peyton Manning 38 1998 326 575 3739 26
1 Peyton Manning 38 1999 331 533 4135 26
2 Peyton Manning 38 2000 357 571 4413 33
3 Peyton Manning 38 2001 343 547 4131 26
4 Peyton Manning 38 2002 392 591 4200 27
when it should be
Name Age Year Cmp Att Yds TD
0 Peyton Manning 38 1998 326 575 3739 26
1 Peyton Manning 38 1999 331 533 4135 26
2 Peyton Manning 38 2000 357 571 4413 33
3 Peyton Manning 38 2001 343 547 4131 26
4 Peyton Manning 38 2002 392 591 4200 27
this can be fixed by replacing the
(-map 's-trim)
in ob-ipython--render with
(-map 's-trim-right)
so that leading whitespaces are kept.