Skip to content Skip to sidebar Skip to footer

How To Align Pandas DataFrame Column Number Text In Jinja

I rendered a Pandas Dataframe to a webpage through Jinja but noticed the number column is left aligned. When I tried applying the code below on the particular column to align right

Solution 1:

I couldn't get a Pandas or Jinja solution that worked. However I stumbled on a this and that solved the whole issue.

It was a CSS trick. I simply had to identify the specific column and applied the code below in my Style.css file.

    tbody>tr>:nth-child(5){
    text-align:right;
    }

The '5' being the column number.

Credit to Charles Riebeling

I believe this will be of help to someone.


Post a Comment for "How To Align Pandas DataFrame Column Number Text In Jinja"