Black Lives Matter. Please consider donating to Campaign Zero's mission of ending police violence in America.
https://www.joincampaignzero.org

Pie chart and dropdown multi-select

Hi everyone! (I’m not good at writing in English, I hope you understand)
I need to do a dashboard with 4 dropdowns multiselect, but at the moment I am testing with only one.
This is the structure of my data:
Captura

What I want to do is change the pie chart when I select one or more dropdown cities (CIUDAD). The Pd variable has 4 categories, and I plot the FACTOR variable in the piechart. I’ve managed to get it to change when the multi = False dropdown, but not when the multi = True dropdown

This is the code I’ve been trying, but it doesn’t work.

# -*- coding: utf-8 -*-
"""
Created on Thu May  7 15:58:14 2020

@author: aascencio
"""


import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import numpy as np
import pandas as pd
import dash_table

df = pd.read_csv(r'C:\Users\aascencio\Desktop\Proyectos\EGM\Observatorio\datos_EGMCuarentena _codigos.csv')
print(df.head())
df.columns

app = dash.Dash()

app.layout = html.Div([
    html.H1('EGM Cuarentena', style={'textAlign': 'center'}),
    html.Hr(),
    html.Div([
        html.Div([
            dcc.Dropdown(
                id='ciudad',
                options=[{'label': i, 'value': i} for i in df['CIUDAD'].unique()])
            ]),
        
        html.Div([
            dcc.Graph(
                id='pie'
                )
            ])
        ])
    ])

@app.callback(
    Output('pie', 'figure'),
    [Input('ciudad','value')])
def update_graph(ciudad):
    pie_data=df[df.CIUDAD==ciudad]
    traces=[]
    traces.append(go.Pie(
        labels=pie_data.PD,
        values=pie_data.FACTOR))
    figure=go.Figure(data=traces)
    return figure
      
if __name__ == '__main__':
    app.run_server()

Thanks for your help!