Created
September 4, 2018 00:36
-
-
Save umitanuki/d6d34d0e5476ed68921c9c0d684bf845 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
from bs4 import BeautifulSoup | |
import requests | |
import re | |
import pandas as pd | |
def main(): | |
res = requests.get('https://www.nasdaq.com/earnings/earnings-calendar.aspx?date=2018-Sep-04') | |
soup = BeautifulSoup(res.content, features='lxml') | |
df = pd.read_html(str(soup.select('table#ECCompaniesTable').pop()))[0] | |
df = df.iloc[1:] | |
symbols = [] | |
for row in df.iterrows(): | |
m = re.search(r'\(([A-Z\.]+)\)', row[1][1]) | |
symbols.append(m.group(1)) | |
df['symbol'] = symbols | |
from IPython import embed | |
embed() | |
if __name__ == '__main__': | |
main() |
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
[[source]] | |
url = "https://pypi.org/simple" | |
verify_ssl = true | |
name = "pypi" | |
[packages] | |
requests = "*" | |
BeautifulSoup4 = "*" | |
IPython = "*" | |
pandas = "*" | |
[dev-packages] | |
[requires] | |
python_version = "3.6" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment