Book Image

Python for Finance

By : Yuxing Yan
Book Image

Python for Finance

By: Yuxing Yan

Overview of this book

Table of Contents (20 chapters)
Python for Finance
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Working with DuPont identity


In finance, we could find useful information from a firm's financial statements such as annual income statement, balance sheet, and cash flow statement. Ratio analysis is one of the commonly used tools to compare the performance among different firms and for the same firm over the years. DuPont identity is one of them. DuPont identity divides Return on Equity (ROE) into three ratios: Gross Profit Margin, Assets Turnover, and Equity Multiplier:

The following code will show those three ratios with different colors. Here we have the following information about some firms:

Ticker

Fiscal Year Ending Date

ROE

Gross Profit Margin

Assets Turnover

Equity Multiplier

IBM

December 31, 2012

0.8804

0.1589

0.8766

6.3209

DELL

February 1, 2013

0.2221

0.0417

1.1977

4.4513

WMT

January 31, 2013

0.2227

0.0362

2.3099

2.6604

The Python code is as follows:

import numpy as np
import matplotlib.pyplot as plt
ind = np.arange(3)
plt.title("DuPont Identity")
plt.xlabel...