Created
November 30, 2017 20:40
-
-
Save memonkey01/3673b0862fbf6a726afa9fdbd58a6cda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Graficando el IPC y otras acciones | |
Autor: Guillermo Izquierdo | |
Este código es para fines educativos | |
""" | |
import pandas_datareader as pdr | |
import matplotlib.pyplot as plt | |
import datetime | |
#Definimos una fecha de | |
end = datetime.datetime(2017,11,29).isoformat() | |
start = datetime.datetime(2017,2,1).isoformat() | |
print(start,end) | |
#Definimos nuestro indice con las fechas previas | |
index = '^MXX' | |
stock = pdr.get_data_yahoo(index, start=start, end=end) | |
close = stock['Close'] #Seleccionamos la columna de cierre | |
print(stock) | |
#Graficamos nuestra serie | |
plt.plot(close, color='b') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment