Q. Write a program to create a histogram that plots two ndarrays x and y with 48 bins, in stacked horizontal histogram.
df
speed meters weight
0 10 122 0.20
1 15 150 0.30
2 20 190 0.10
3 18 230 0.85
4 19 300 0.00
Answer :-
import pandas as pd import matplotlib.pyplot as pl # df created pl.scatter(df[ 'meters'], df['weight']) pl.hist([y,x], bins = 48, orientation = 'horizontal', histtype = 'barstacked') pl.show()
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )