Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ImportadorExportadorYahoo (object):
- start = "2000-1-4"
- end = date.today()
- def __init__(self, nombre, ticker, fichero_excel=None, fichero_csv=None):
- #self.start = start
- #self.end = end
- self.nombre = nombre
- self.ticker = ticker
- self.fichero_excel = fichero_excel
- self.fichero_csv = fichero_csv
- def actualizar(self):
- df = pd_data.DataReader(ticker, "yahoo", self.start, self.end)
- print ("nCotizaciones ", nombre," n", df[:3])
- df.to_excel (self.fichero_excel)
- df.to_csv (self.fichero_csv)
- os.chdir("G:/Py_2019/Py_micartera_POO/Ficheros_Yahoo")
- """Nombres de columnas del fichero csv: "lista_nombres" y "lista_tickers" """
- df = pd.read_csv("lista_valores.csv")
- data = df[df["ID"] == "Y"]
- for i in range(0,data.shape[0]):
- nombre = data["nombres"][i]
- ticker = data["tickers"][i]
- fichero_excel = data["ficheros_xlsx"][i]
- fichero_csv = data["ficheros_csv"][i]
- obj = ImportadorExportadorYahoo(nombre, ticker, fichero_excel, fichero_csv)
- obj.actualizar()
- ValueError: No engine for filetype: 'csv'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement