The following code (which I got from a different SO question) is supposed to print out a table with some colored cells. However, it does not print in color:
import pandas as pd
from IPython.core.display import HTML
from IPython.display import display
df = pd.DataFrame([[2,3,1], [3,2,2], [2,4,4]], columns=list("ABC"))
df.style.apply(lambda x: ["background: red" if v > x.iloc[0] else "" for v in x], axis = 1)
df
print(df)
display(df)
display(HTML(df.to_html()))
print('hi')
But, as per the SO example I linked to above, it's supposed to look like this:

This may be some useful information:
(stats_env) raj@r-sb2:~/repos/fix_print$ jupyter --version
jupyter core     : 4.6.3
jupyter-notebook : 6.1.1
qtconsole        : not installed
ipython          : 7.17.0
ipykernel        : 5.3.4
jupyter client   : 6.1.6
jupyter lab      : not installed
nbconvert        : 5.6.1
ipywidgets       : not installed
nbformat         : 5.0.7
traitlets        : 4.3.3

 
    