• 1000 У меня в знаменателе 0, он возвращает Nan, моя функция выглядит так:
def get_roic(BS, KPI, IC):
table = KPI.loc['fcf'].to_frame('fcf')
table['Invested Capital'] = (BS.loc['st_debt'] + BS.loc['other_current_liabilities'] +
BS.loc['lt_debt'] + BS.loc['other_lt_liabilities'] + BS.loc['total_equity'])
table['roic'] = table['fcf'].divide(table['Invested Capital'])
table['revenue'] = IC.loc['revenue']
table['fcf/revenue'] = table['fcf'].divide(table['revenue'])
return table
Я пробовал много вещей, например:
def get_roic(BS, KPI, IC):
table = KPI.loc['fcf'].to_frame('fcf')
table['Invested Capital'] = (BS.loc['st_debt'] + BS.loc['other_current_liabilities'] + BS.loc['lt_debt'] + BS.loc['other_lt_liabilities'] + BS.loc['total_equity'])
table['roic'] = table['fcf'].divide(table['Invested Capital'].where(table['Invested Capital'] != 0.0, np.nan))
table['revenue'] = IC.loc['revenue']
table['fcf/revenue'] = table['fcf'].divide(table['revenue'].where(table['revenue'] != 0.0, np.nan))
return table
Но мне не удалось заставить его работать. . есть идеи?