|
import streamlit as st |
|
import pandas as pd |
|
import plotly.express as px |
|
|
|
def load_data(): |
|
df = pd.DataFrame({ |
|
"tax_type": ["Income Tax", "Sales Tax", "Property Tax", "Corporate Tax", "Value Added Tax (VAT)", |
|
"Income Tax", "Sales Tax", "Property Tax", "Corporate Tax", "Value Added Tax (VAT)"], |
|
"compliance": [0.75, 0.82, 0.60, 0.70, 0.65, |
|
0.79, 0.75, 0.66, 0.72, 0.68] |
|
}) |
|
return df |
|
|
|
def compliance_analysis(tax_type): |
|
df = load_data() |
|
|
|
compliance_rate = df[df["tax_type"] == tax_type]["compliance"].mean() |
|
compliance_rate = round(compliance_rate * 100, 2) |
|
|
|
df = df.groupby("tax_type").mean().reset_index() |
|
df = df.sort_values("compliance", ascending=False) |
|
|
|
fig = px.bar(df, x="compliance", y="tax_type", color="tax_type", orientation="h", |
|
title="Average Compliance Rate for Tax Types", |
|
labels={"compliance": "Compliance Rate (%)", "tax_type": "Tax Type"}) |
|
|
|
fig.update_xaxes(ticktext=[str(round(v * 100, 2)) + "%" for v in df["compliance"]], |
|
tickvals=df["compliance"] * 100) |
|
|
|
return fig |
|
|
|
tax_types = ["Income Tax", "Sales Tax", "Property Tax", "Corporate Tax", "Value Added Tax (VAT)"] |
|
tax_type = st.selectbox("Tax Type", tax_types, index=0) |
|
|
|
st.plotly_chart(compliance_analysis(tax_type)) |
|
|
|
|