Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

136
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda