Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

141
Vistas
How to manipulate a pandas dataframe using a JavaScript callback in Bokeh?

With Bokeh, is it possible to manipulate a pandas dataframe from within a JavaScript callback? I don't want to have to rely on a Bokeh server.

I have a slider and a dropdown menu. The slider selects the year. The menu selects which dataframe I'll use via category (there are multiple dataframes, but they are all derived from the same parent dataframe).

The data I want to update is a dictionary that relies on pandas to select values based on the top 10 values of a specific column from within one of several dataframes, like this:

def update_plot(attr, old, new):

    year = my_slider.value
    category = select_category.value

    match category:
          case 'category1':
              my_df = df1
          
          case 'category2':
              my_df = df2
                                 # select the top 10 paid people for a specific year
    new_data = { 'person_name' : my_df[my_df['YEAR'] == year].nlargest(10, 'salary').person_name }

.nlargest is a member function of a pandas dataframe. My guess is that I won't be able to call that function using JavaScript, and I need to use JavaScript so that I don't have to rely on the Bokeh server. I'm pretty clueless as to how I'd achieve the same effect using JavaScript.

Any guidance is appreciated. I think I shared all of the relevant parts of my script needed to answer this question, but I can provide more if needed.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda