Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. class ImportadorExportadorYahoo (object):
  2. start = "2000-1-4"
  3. end = date.today()
  4.  
  5. def __init__(self, nombre, ticker, fichero_excel=None, fichero_csv=None):
  6. #self.start = start
  7. #self.end = end
  8. self.nombre = nombre
  9. self.ticker = ticker
  10. self.fichero_excel = fichero_excel
  11. self.fichero_csv = fichero_csv
  12.  
  13. def actualizar(self):
  14. df = pd_data.DataReader(ticker, "yahoo", self.start, self.end)
  15. print ("nCotizaciones ", nombre," n", df[:3])
  16. df.to_excel (self.fichero_excel)
  17. df.to_csv (self.fichero_csv)
  18.  
  19. os.chdir("G:/Py_2019/Py_micartera_POO/Ficheros_Yahoo")
  20.  
  21. """Nombres de columnas del fichero csv: "lista_nombres" y "lista_tickers" """
  22. df = pd.read_csv("lista_valores.csv")
  23. data = df[df["ID"] == "Y"]
  24. for i in range(0,data.shape[0]):
  25. nombre = data["nombres"][i]
  26. ticker = data["tickers"][i]
  27. fichero_excel = data["ficheros_xlsx"][i]
  28. fichero_csv = data["ficheros_csv"][i]
  29. obj = ImportadorExportadorYahoo(nombre, ticker, fichero_excel, fichero_csv)
  30. obj.actualizar()
  31.  
  32. ValueError: No engine for filetype: 'csv'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement