This file contains hidden or 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
| #pip install EIA-python | |
| #pip install networkx | |
| import numpy as np | |
| import pandas as pd | |
| import eia | |
| import networkx as nx | |
| import matplotlib.pyplot as plt | |
| #Get API key from EIA website and pass into eia.API() method | |
| apiKey = "5f54b3e66477e22ec068066b1de8026d" |
This file contains hidden or 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
| import scrapy | |
| import pandas | |
| from ..items import YahooItem | |
| class YahooSpider(scrapy.Spider): | |
| name = 'Yahoo' | |
| symbols = ["ADSK","BA","CAT","EBAY","GS","HSY","IBM","JPM","WMT","SHOP", | |
| "T", "F", "TRI", "AMZN", "C", "A", "O", "B","MSFT", "NVDA", | |
| "DIS", "AAL", "NFLX", "JNJ","BAC","GOOGL", "WFC"] | |
| start_urls = ['https://finance.yahoo.com/quote/{0}/history?p={0}'.format(x) for x in symbols] |
This file contains hidden or 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
| from datetime import datetime, timedelta | |
| import time, requests, pandas, lxml | |
| from lxml import html | |
| def format_date(date_datetime): | |
| date_timetuple = date_datetime.timetuple() | |
| date_mktime = time.mktime(date_timetuple) | |
| date_int = int(date_mktime) | |
| date_str = str(date_int) | |
| return date_str |
This file contains hidden or 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
| import pandas as pd | |
| import numpy as np | |
| from bs4 import BeautifulSoup | |
| import requests, lxml | |
| from lxml import html | |
| class statistics: |