I'm trying to do a calculation based on information that I have in two different datasets. I need all the information for the first dataframe repetead as many times as the information of the second dataframe.
Example:
DataFrame 1:
name price
A 1
B 2
DataFrame 2:
currency value
Dollar 1
Euro 2
Expected output:
DataFrame merged:
name price currency Value
A 1 Dollar 1
A 1 Euro 1
B 2 Dollar 4
B 2 Euro 4
I've been trying something similar like this, with using an apply and a list, and then converting it into a DataFrame, but with no results. Somehow the currs values is always repeated for every name:
lst = []
for index, currs in currencies.iterrows():
lst.append(prices.apply(lambda pmRow: pd.Series({'name':pmRow['prices'], 'curr':currs['currency']}), axis=1))
Any suggestions? Thanks!