위 데이터프레임에서 다음과 같이 필요한 항목을 추출할 수 있다.
# 자기자본이익률(ROE)
combined_extra_stats[ combined_extra_stats.Attribute.str.contains( "Return on Equity" ) ]
# 총자산이익률(ROA)
combined_extra_stats[ combined_extra_stats.Attribute.str.contains( "Return on Assets" ) ]
# 이익률(profit margin)
combined_extra_stats[ combined_extra_stats.Attribute.str.contains( "Profit Margin" ) ]
결과
자기자본이익률(ROE) ticker Attribute Value 33 amzn Return on Equity (ttm) 24.95% 83 ba Return on Equity (ttm) NaN 133 msft Return on Equity (ttm) 41.40% 183 aapl Return on Equity (ttm) 73.69% 233 goog Return on Equity (ttm) 17.51% 총자산이익률(ROA) ticker Attribute Value 32 amzn Return on Assets (ttm) 5.17% 82 ba Return on Assets (ttm) -2.92% 132 msft Return on Assets (ttm) 12.10% 182 aapl Return on Assets (ttm) 12.51% 232 goog Return on Assets (ttm) 7.74% 이익률(profit margin) ticker Attribute Value 30 amzn Profit Margin 4.99% 80 ba Profit Margin -7.34% 130 msft Profit Margin 32.28% 180 aapl Profit Margin 20.91% 230 goog Profit Margin 20.80%