finance

Merge multiple (2+) dataframes in Pandas with a proper column name

Merge multiple (2+) dataframes in Pandas with a proper column name Question: everyone. I have the following list of dataframes: df_eurusd = DownloadData(‘EUR/USD’,start_date,end_date,timeframe).GetData() df_usdjpy = DownloadData(‘USD/JPY’,start_date,end_date,timeframe).GetData() df_gbpusd = DownloadData(‘GBP/USD’,start_date,end_date,timeframe).GetData() df_usdcad = DownloadData(‘USD/CAD’,start_date,end_date,timeframe).GetData() df_usdsek = DownloadData(‘USD/SEK’,start_date,end_date,timeframe).GetData() df_usdchf = DownloadData(‘USD/CHF’,start_date,end_date,timeframe).GetData() tickers = { ‘EUR/USD’ : df_eurusd, ‘USD/JPY’ : df_usdjpy, ‘GBP/USD’ : df_gbpusd, ‘USD/CAD’ : df_usdcad, ‘USD/SEK’ : …

Total answers: 2

How to get company earning announcements data api?

How to get company earning announcements data api? Question: I want to get real-time earning annoouncements data api. I tried yfinance but it doesn’t work currently. So is there any other replacement api? Most of API need to pay money, But I just want to try for my personal projects so it’s little pressured Does …

Total answers: 1

QuantLib Python: How to calculate the price of a zero coupon bond?

QuantLib Python: How to calculate the price of a zero coupon bond? Question: I would like to calculate the price of a 5-year zero-coupon bond at 10% interest with a face value of $1000. I expect such a bond to be priced at $620.92 since $620.92 = 1000/((1.10)^5). Here’s my attempt in Python (Version 3.9.12) …

Total answers: 1

Scraping data off Morningstar – Portfolio Screen

Scraping data off Morningstar – Portfolio Screen Question: I am trying to scrape data from this link https://www.morningstar.com/funds/xnas/gibix/portfolio — basically all the data I can get, but particularly the Fixed Income Style Table and the Exposure, Bond Breakdown table. Here is my code: import requests from selenium import webdriver import pandas as pd link = …

Total answers: 1

Finding <p style class using BeautifulSoup

Finding <p style class using BeautifulSoup Question: I am trying to scrape MSFT’s income statement using code I found here: How to Web scraping SEC Edgar 10-K Dynamic data They use the ‘span’ class to narrow the search. I do not see a span, so I am trying to use the <p class with no …

Total answers: 1

ValueError: At least one array required as input error when dividing the set

ValueError: At least one array required as input error when dividing the set Question: I work on a finance forecasting project I did my preprocessing part but when I try to construct train and test set I got an error I have constructed my DataFrame as alldata = pd.DataFrame({‘Date’:date, ‘S&P 500 Price’:normalised_snp, ‘S&P 500 Open’: …

Total answers: 1

Count consecutive row values but reset count with every 0 in row

Count consecutive row values but reset count with every 0 in row Question: Within a dataframe, I need to count and sum consecutive row values in column A into a new column, column B. Starting with column A, the script would count the consecutive runs in 1s but when a 0 appears it prints the …

Total answers: 2