2808 explained code solutions for 75 technologies


python-matplotlibHow to make bar chart from Pandas Dataframe


import matplotlib.pyplot as plt
import pandas as pd

data = {
  'iPhone.': [12, 900, 78],
  'Android': [204, 501, 800]
}

df = pd.DataFrame(data, index = ['some', 'metric', 'other'])

df.plot.bar()

plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities

import pandas as pd

load Pandas module

data = {

define data for data frame

pd.DataFrame

create Pandas Dataframe from specified data

index =

specify column names

plot.bar()

will plot Dataframe data as bar charts

.show()

render chart in a separate window