9951 explained code solutions for 126 technologies

python-pandasHow to draw data frame histogram (bars charts)

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

a = {'a': np.random.normal(0,1,100), 'b' : np.random.normal(1,2,100)}
df = pd.DataFrame.from_dict(a)

plt.show()ctrl + c
import pandas as pd

load Pandas module

import numpy as np

load Numpy module for Python


generates 100 elements with 0 mean and 1 standard deviation


creates Pandas DataFrame object from given dict (a)


plots DataFrame data as a bar chart

import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities


renders plotted data