I have two dataframes. One dataframe contains financial figures of different companies and the other one contains the corresponding industry codes. I would now like to add the corresponding industry codes to the companies. The problem is that the financial figures are contained for several years and therefore the companies are contained in one dataframe more often than in the other. Both dataframes don't have the same length and therefore I cannot simply merge them.
Of course this code is not correct, but hopefully it helps making my point clear.
dataframe1['Industry'] = dataframe2['Industry'] if dataframe1['name'] = dataframe2['name']
Dataframe1
The column names are: Year Cusip Name Current Assets Trade Liabilities
2010.0 825690100 SHUTTERSTOCK INC 90480.0 4680.0
2011.0 825690100 SHUTTERSTOCK INC 180740.0 18380.0
Dataframe2
column names: Cusip IndustryCode
521893107 3714
605288208 2873
549463107 3661
783755101 3462
74377P203 4833
As I said, I just want to add the industry codes to the dataframe1 so I have the financial ratios and Industry Codes for all companies and for every year.
BR