Created
July 31, 2020 18:34
-
-
Save imjkrao/7db8588b48c936fb7081134484d8e05b to your computer and use it in GitHub Desktop.
compare2df
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 | |
from datetime import datetime | |
from datetime import timedelta | |
from yahoo_earnings_calendar import YahooEarningsCalendar | |
#import dateutil.parser | |
#setting the report date | |
report_date = datetime.now().date() | |
#downloading the earnings calendar | |
yec = YahooEarningsCalendar() | |
earnings_list = yec.earnings_on(report_date) | |
#saving the data in a pandas DataFrame | |
earnings_df = pd.DataFrame(earnings_list) | |
table=pd.read_html('https://en.wikipedia.org/wiki/List_of_S%26P_500_companies') | |
snp = table[0] | |
snp= snp['Symbol'] | |
print(snp) | |
tickers_in_snp=earnings_df[earnings_df['ticker'].isin(snp)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment