title: Why doesn't plotly show the graph, when I execute the same statements inside a class?
body: <p>I am learning classes. The script below, shows the graph correctly using plotly express, but if I integrate it as a method in a class, it doesn't.
  I show the classes below. With the first one, we import quotes from Yahoo! With the second, we try to represent a graph of the imported normalized prices.</p>
  <pre><code>import pandas as pd
  import pandas_datareader as pdr 
  import datetime as dt
  from datetime import date
  from plotly.offline import iplot
  import plotly.express as px 
  
  class ImportadorCotizaciones:
  
      def __init__(self):
          self.cotizaciones = None
          self.start = &quot;2000-1-4&quot;
          self.end = date.today()
          self.cotizaciones = None
  
      def Importar_cotizaciones(self):
  
          dicc_tickers = {&quot;IBE.MC&quot;:&quot;Iberdrola&quot;, &quot;TEF.MC&quot;:&quot;Telefonica&quot;, &quot;^IBEX&quot;:&quot;Ibex35&quot; }
          dfs = []
          nombres = []
  
          for (k,v) in dicc_tickers.items():
              self.cotizaciones_de_ticker = pdr.DataReader(k, 'yahoo', self.start, self.end)
              self.cotizaciones_de_ticker = self.cotizaciones_de_ticker[[&quot;Close&quot;]]
              self.cotizaciones_de_ticker = self.cotizaciones_de_ticker.rename(columns={&quot;Close&quot;: v})
  
              dfs.append(self.cotizaciones_de_ticker)
  
          dfs = iter(dfs)
          self.cotizaciones = next(dfs)
          for df_ in dfs:
              self.cotizaciones = self.cotizaciones.merge(df_, on='Date')
  
  class Indicadores:
      def __init__(self, importador):
          self.importador = importador 
      
      def dibujar_grafico(self):
          self.aux_val_ind = importador.cotizaciones[[&quot;Iberdrola&quot;, &quot;Ibex35&quot;]].pct_change().dropna() 
          df = self.aux_val_ind.copy(deep=True)
          df['Media'] = df.mean(axis = 1) 
          # Usando plotly.express       
          px.line((df + 1).cumprod() ,y=df.columns ,title=f&quot;\nValor de 1€ invertido desde el { importador.start}  hasta el {importador.end} &quot;)
  
  importador = ImportadorCotizaciones()
  importador.Importar_cotizaciones()
  importador.cotizaciones[:3] 
  
  indicadores = Indicadores(importador)
  indicadores.dibujar_grafico()
  </code></pre>
  <p>The script that works outside the class is:</p>
  <pre><code># Usando plotly.express
  from plotly.offline import iplot
  import plotly.express as px
  
  start = &quot;2000-1-4&quot;
  end = date.today()
  aux_val_ind = importador.cotizaciones[[&quot;Iberdrola&quot;, &quot;Ibex35&quot;]].pct_change().dropna() 
  df = aux_val_ind.copy(deep=True)
  df['Media'] = df.mean(axis = 1) 
  
  px.line((df + 1).cumprod() ,y=df.columns ,title=f&quot;\nValor actual de 1€ invertido el {start} &quot;)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/TfbPo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TfbPo.png" alt="enter image description here" /></a></p>