import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
data = pd.read_csv("Sample Data - Employment.csv", index_col="Pec #")
data.drop(
["Engr Name", "Sr"], axis=1, inplace=True
) # droping name column for privacy purpose
data.head()
fig = px.histogram(
data,
x="Discplin",
color="Discplin",
labels={"Discplin": "Type of Engineers"},
title="Engineering Discipline",
)
fig.show()
DE = (
data[["Discplin", "Employment Sector"]]
.value_counts()
.rename_axis(["Discipline", "Employment Sector"])
.reset_index(name="counts")
)
fig = px.sunburst(
DE,
path=["Discipline", "Employment Sector"],
values="counts",
title="Engineering Discipline and Employment Sector Sunburst",
)
fig.show()
PIE = (
data[["Employment Sector"]]
.value_counts()
.rename_axis(["Employment Sector"])
.reset_index(name="counts")
)
fig = go.Figure(
data=[go.Pie(labels=PIE["Employment Sector"], values=PIE.counts, hole=0.3)]
)
fig.update_traces(textposition="inside", textinfo="percent+label")
fig.show()
%%HTML
<div class='tableauPlaceholder' id='viz1622877203245' style='position: relative'><noscript><a href='https://www.pec.org.pk'><img alt='Dashboard 1 ' src='https://public.tableau.com/static/images/PI/PITCData/Dashboard1/1_rss.png' style='border: none' /></a></noscript><object class='tableauViz' style='display:none;'><param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' /> <param name='embed_code_version' value='3' /> <param name='site_root' value='' /><param name='name' value='PITCData/Dashboard1' /><param name='tabs' value='no' /><param name='toolbar' value='yes' /><param name='static_image' value='https://public.tableau.com/static/images/PI/PITCData/Dashboard1/1.png' /> <param name='animate_transition' value='yes' /><param name='display_static_image' value='yes' /><param name='display_spinner' value='yes' /><param name='display_overlay' value='yes' /><param name='display_count' value='yes' /><param name='language' value='en-US' /></object></div> <script type='text/javascript'> var divElement = document.getElementById('viz1622877203245'); var vizElement = divElement.getElementsByTagName('object')[0]; if ( divElement.offsetWidth > 800 ) { vizElement.style.minWidth='820px';vizElement.style.maxWidth='1220px';vizElement.style.width='100%';vizElement.style.minHeight='587px';vizElement.style.maxHeight='887px';vizElement.style.height=(divElement.offsetWidth*0.75)+'px';} else if ( divElement.offsetWidth > 500 ) { vizElement.style.minWidth='820px';vizElement.style.maxWidth='1220px';vizElement.style.width='100%';vizElement.style.minHeight='587px';vizElement.style.maxHeight='887px';vizElement.style.height=(divElement.offsetWidth*0.75)+'px';} else { vizElement.style.width='100%';vizElement.style.height='1777px';} var scriptElement = document.createElement('script'); scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js'; vizElement.parentNode.insertBefore(scriptElement, vizElement); </script>