'divide Stocks-Data wit Earnigs per share - Data to get the P/E ratio
I have this Data(from Refinitive Workspace) df_sxde(this are close prices from different stocks) and df_eps(this are the earnigs per share)
i want to divide df_sxde by df_eps so i can get my P/E ratio->(df_sxde/df_eps=P/E ratio)
df_sxde = ek.get_data(instruments=['SASY.PA', 'ESLX.PA', 'SHLG.DE', 'BAYGn.DE',
'PHG.AS', 'FREG.DE', 'FMEG.DE', 'MRCG.DE', 'EUFI.PA', 'UCB.BR'],
fields=['TR.PriceClose(SDate=2021-05-31,Curn=EUR)'])
df_eps = ek.get_data(instruments=['SASY.PA', 'ESLX.PA', 'SHLG.DE', 'BAYGn.DE',
'PHG.AS', 'FREG.DE', 'FMEG.DE', 'MRCG.DE', 'EUFI.PA', 'UCB.BR'],
fields=['TR.BasicEpsExclExtraItems(SDate=0CY,Period=FY0,Curn=EUR)'])
Solution 1:[1]
Assuming your DataFrames have matching shapes you can simply do:
df_pe = df_sxde / df_eps
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
