Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. from plotly.graph_objs import graph_objs as go
  2. import plotly.figure_factory as ff
  3.  
  4. # For Offline plotting
  5. from plotly.offline import init_notebook_mode, iplot, plot
  6. init_notebook_mode(connected=True)
  7.  
  8. # Selecting data for female fare | male fare distribution
  9.  
  10. trace0 = go.Box(
  11. x = train.loc[(train['Sex']=='female'), 'Fare'].dropna().values,
  12. name = "Female"
  13. )
  14.  
  15. trace1 = go.Box(
  16. x = train.loc[(train['Sex']=='male'), 'Fare'].dropna().values,
  17. name = "Male"
  18. )
  19.  
  20. trace= [trace0, trace1]
  21. fig = go.Figure(data=trace)
  22.  
  23. # Updating Layout meta
  24. fig['layout'].update(go.Layout(title="Fare Distribution",
  25. xaxis={'title':'Fare'})
  26.  
  27. # Plot!
  28. iplot(fig, filename="Fare_Distribution_Plot")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement