Can I Buy My Own Income?

It feels good carrying a bunch of money
See. Over a 100,000 rows
The query I wrote to return the table of company dividends organized by month
allCompany_df = pd.DataFrame([[0, 0, 0, 0,0,0, 0, "0", "0", 0, 0]], columns=['1. open', '2. high', '3. low', '4. close', '5. adjusted close', '6. volume', '7. dividend amount', 'Company_Ticker', 'Company_name', 'month', 'year'])i = 0#for symbol in chunker(lstOFa, 1):for symbol in listOfCompanies:div_monthly_summary = f"https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY_ADJUSTED&symbol={symbol}&apikey={APIkey}"parsed_divs = json.loads(requests.get(div_monthly_summary).text)### make a row for each date in the 'Monthly Adjusted Time Series' with the### dividend amount as the entry"""div_dates = list(parsed_divs.items())date_cols = list(div_dates[1][1].keys())"""monthly_time_series_df = pd.DataFrame.from_dict(parsed_divs['Monthly Adjusted Time Series'], orient ='index')monthly_time_series_df['Company_ticker'] = symbolmonthly_time_series_df['Company_name'] = trimmedSP500['Security'][i]monthly_time_series_df['month'] = pd.DatetimeIndex(monthly_time_series_df.index).monthmonthly_time_series_df['year'] = pd.DatetimeIndex(monthly_time_series_df.index).yearmonthly_time_series_df.reset_index(drop=True, inplace=True)print(monthly_time_series_df.head(3))allCompany_df = pd.concat([allCompany_df, monthly_time_series_df])x = i % 5if x == 0:sleep(65)i += 1#parsed_overview, parsed_intra, wiwtk#print(week_avgPEratio)allCompany_df

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store