Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from plotly.graph_objs import graph_objs as go
- import plotly.figure_factory as ff
- # For Offline plotting
- from plotly.offline import init_notebook_mode, iplot, plot
- init_notebook_mode(connected=True)
- # Selecting data for female fare | male fare distribution
- trace0 = go.Box(
- x = train.loc[(train['Sex']=='female'), 'Fare'].dropna().values,
- name = "Female"
- )
- trace1 = go.Box(
- x = train.loc[(train['Sex']=='male'), 'Fare'].dropna().values,
- name = "Male"
- )
- trace= [trace0, trace1]
- fig = go.Figure(data=trace)
- # Updating Layout meta
- fig['layout'].update(go.Layout(title="Fare Distribution",
- xaxis={'title':'Fare'})
- # Plot!
- iplot(fig, filename="Fare_Distribution_Plot")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement