skip to Main Content

I wrote the code in ipynb as same as the video class :

import plotly.express as px 

grafico = px.histogram(tabela, x="duracao_contrato", color="cancelou",color_discrete_map="blues")

grafico.show()

but when I run the code the message that shows is NameError: name ‘tabela’ is not defined

What I’m doing wrong? Could someone help me please?

I followed all the teacher’s suggestions and installed everything he asked. I’m using VSCode on Linux Ubuntu, does it have any specific extensions that I should check if I’m missing?

2

Answers


  1. Gleyce, I believe you watched Lira Hashtag. I’m also following the classes and i got at the same situation. I basically ran all the codes again since of the beginning or you can just apply the "Run All"

    If not works try to retire the "discrete_color" part.

    I hope I help you 🙂

    See ya !

    Login or Signup to reply.
  2. I tried too but does not work at all, even tried to restart the kernel but is just not working the part to show the grafic.

    import pandas as pd
    
    tabela = pd.read_csv("cancelamentos.csv")
    
    tabela = tabela.drop(columns="CustomerID")
    display(tabela)
    
    tabela = tabela.dropna()
    display(tabela.info())
    
    display(tabela["cancelou"].value_counts())
    
    display(tabela["cancelou"].value_counts(normalize=True))
    
    import plotly.express as px
    
    grafico = px.histogram(tabela, x="duracao_contrato", color="cancelou")
    grafico.show()
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search