- Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathboxplot_simple.py
More file actions
Latest commit
24 lines (18 loc) · 618 Bytes
/
Copy pathboxplot_simple.py
File metadata and controls
24 lines (18 loc) · 618 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
importpandasaspd
importplotly
importplotly.graph_objsasgo
fromplotly.offlineimport*
# To initiate ploty to run offline
init_notebook_mode(connected=True)
# Import data
df=pd.read_csv('../Data/salary.csv')
# Prepare data
data= []
forschoolindf['school'].unique():
df_temp=df[df['school']==school]
data.append(go.Box(y=df_temp['salary'], name=school, boxmean=True))
# Layout
layout=dict(title={'text':'Alumni Salary across Schools', 'x':0.5},
barmode='group', xaxis=dict(tickmode='linear'))
fig=go.Figure(data=data, layout=layout)
plotly.offline.plot(fig, filename='box.html')