Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Python for Finance
  • Table Of Contents Toc
Python for Finance

Python for Finance

By : Yuxing Yan
3.9 (22)
close
close
Python for Finance

Python for Finance

3.9 (22)
By: Yuxing Yan

Overview of this book

A hands-on guide with easy-to-follow examples to help you learn about option theory, quantitative finance, financial modeling, and time series using Python. Python for Finance is perfect for graduate students, practitioners, and application developers who wish to learn how to utilize Python to handle their financial needs. Basic knowledge of Python will be helpful but knowledge of programming is necessary.
Table of Contents (14 chapters)
close
close
13
Index

Statistic submodule (stats) from SciPy


One special module called stats contained in the SciPy module is worthy of special attention, since many of our financial problems depend on this module. To find out all the contained functions, we have the following lines of code:

>>>from scipy import stats
>>>dir(stats)

To save space, only a few lines are shown in the following screenshot:

From the output, not shown completely in the preceding screenshot, we could find a ttest_1samp() function. To use the function, we generate 100 random numbers drawn from a standard normal distribution, zero mean, and unit standard deviation. For the one-sample T-test, we test whether its mean is 0. Based on the t-value (1.18) and p-value (0.24), we could not reject the null hypothesis. This means that the mean of our x is zero as shown in the following lines of code:

>>>import numpy as np
>>>from scipy import stats
>>>np.random.seed(124) # get the same random values
&gt...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Python for Finance
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon