Whenever I run this code on jupyter notebook, it produces the correct highlighted dataframe:
import pandas as pd
import numpy as np
np.random.seed(24)
df = pd.DataFrame({'A': np.linspace(1, 10, 10)})
df = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), columns=list('BCDE'))],
axis=1)
def highlight_greaterthan(x):
if x.C > .5:
return ['background-color: yellow']*5
else:
return ['background-color: white']*5
df.style.apply(highlight_greaterthan, axis=1)
However, when I run it in my mac terminal, I received this output:
<pandas.io.formats.style.Styler object at 0x118a6e198>
I was wondering how I would be able to run this through the terminal and receive the output with the highlighted dataframe. Thank you for any help.