Skip to content

Instantly share code, notes, and snippets.

@umitanuki
Created September 4, 2018 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umitanuki/d6d34d0e5476ed68921c9c0d684bf845 to your computer and use it in GitHub Desktop.
Save umitanuki/d6d34d0e5476ed68921c9c0d684bf845 to your computer and use it in GitHub Desktop.
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()
[[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