text_html_output_1.png
from pandasql import sqldf

import plotly.express as px

species = sqldf("SELECT species, COUNT(species) AS size FROM df_villagers GROUP BY species ORDER BY size DESC")
pie = px.pie(species, values='size', names='species', title='Villager Species', color_discrete_sequence=px.colors.qualitative.Dark24,)
pie.show()

barh = px.bar(species, x="size", y="species", orientation='h', color="size",  title='Villager Species')
barh.update_layout(
    
    autosize=False,
    height=800,
)
barh.show()

gender = sqldf('SELECT gender, COUNT(gender) AS count FROM df_villagers GROUP BY gender ORDER BY count DESC')
species_gender = sqldf('SELECT species, gender, COUNT(gender) AS count FROM df_villagers GROUP BY species, gender ORDER BY count ASC')
fig = px.pie(gender, values='count', names='gender', title='Gender Breakdown')
fig.show()
bar = px.bar(species_gender, x='species', y='count', color='gender', title='Gender and Species')
bar.show()