# check out https://dash.plotly.com/ for Dash documentation
# check out https://plotly.com/python for Plotly documentation
# check out Plotly High Level refernece docs: https://plotly.com/python-api-reference/plotly.express.html
# Plotly Studio sign-up: https://docs.google.com/spreadsheets/d/1Z4DVKKXIeFOpe6mOfBGN5QAdYeJrW4X2mKT1UlxeYDE/edit?usp=sharing
# Adam's LinkedIn: https://www.linkedin.com/in/charming-data/
from dash import Dash, Input, Output, callback, dcc, html
import pandas as pd
import plotly.express as px
# Download data (Github): https://github.com/plotly/datasets/blob/master/2018_Central_Park_Squirrel_Census_-_Squirrel_Data_20250721.csv
# Downlaod data (NYC portal): https://data.cityofnewyork.us/Environment/2018-Central-Park-Squirrel-Census-Squirrel-Data/vfnx-vebw/about_data
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/refs/heads/master/2018_Central_Park_Squirrel_Census_-_Squirrel_Data_20250721.csv')
"""
Use this sectiont to slice, clean, filter data to prepare it for the figure
"""
daily_counts = df.groupby("Shift").size().reset_index(name="Count")
# Build the figure
fig = px.bar(
daily_counts,
x="Shift",
y="Count",
title="",
labels={"Count": "Number of Sightings", "Date": "Date"}
)
app = Dash(__name__)
app.layout = html.Div(
children=[
# assign the fig to the 'figure' property to view
dcc.Graph(figure=fig)
]
)
# Plotly Studio sample -- https://centralparksquirrels.plotly.app