Reputation: 207952
Coming from a SQL backend, I have the below information in a dataframe.
How can I plot a table with bar charts?
Upvotes: 0
Views: 687
Reputation: 8634
One way is to use the built-in styling functionality of pandas dataframes. Below is an example taken from the pandas documentation.
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)
df.iloc[0, 2] = np.nan
df.style.bar(subset=['A', 'B'], color='#d65f5f')
produces the following HTML output:
Upvotes: 2