Performing an inner join of data from Excel using Python
I have an Excel file. In the images below there are the two sheets it has. I am trying to create a code in Python that takes into account the ISIN's that have "Weight" in image 2 (sheet 2) and then filter the data from those same ISIN in sheet 1.
Spreadsheets
Sheet 1
Sheet 2 
Code
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
pd.set_option("precision", 3)
portfolio = pd.read_excel("Track Record.xlsx", sheet_name="Track Record")
portfolio.set_index( "Date", inplace=True)
portfolio_t= portfolio.T
weights = pd.read_excel("Track Record.xlsx", sheet_name="Weights").dropna()
#inner_join= pd.merge(portfolio_t,weights, on='ISIN' , how='inner')
I was trying to solve my problem with a merge, but perhaps that is not the best way.
from Recent Questions - Stack Overflow https://ift.tt/3uu5431
https://ift.tt/37Cot8j
Comments
Post a Comment