Introduction to Python - Data Science, Quantitative Finance (2.0) by Li Lilan
Author:Li, Lilan [Li, Lilan]
Language: eng
Format: epub
Published: 2021-09-27T00:00:00+00:00
Now we have a 2D ndarray and we try to do some operations on each column and row:
>>> b.sum(axis=0) # sum of each column
array([12, 15, 18, 21])
>>>
>>> b.min(axis=1) # min of each row
array([0, 4, 8])
>>>
>>> b.cumsum(axis=1) # cumulative sum along each row
array([[ 0, 1, 3, 6],
[ 4, 9, 15, 22],
[ 8, 17, 27, 38]])
>>> b.prod(axis = 0) # matrix product for each column
array([ 0, 45, 120, 231])
Since the ndarray is a 2D, if we set axis = 2 , it will return error:
>>> b.prod(axis = 2)
AxisError: axis 2 is out of bounds for array of dimension 2
NumPy also provides familiar mathematical functions such as sin , cos , exp and sqrt . In NumPy, these are called 'universal functions'(ufunc).
>>> a = 2.4
>>> np.sqrt(a)
1.5491933384829668
>>> np.exp(a)
11.023176380641601
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Corporate Finance | Crowdfunding |
Financial Engineering | Financial Risk Management |
Wealth Management |
The Black Swan by Nassim Nicholas Taleb(6719)
Bad Blood by John Carreyrou(6244)
Pioneering Portfolio Management by David F. Swensen(6030)
Millionaire: The Philanderer, Gambler, and Duelist Who Invented Modern Finance by Janet Gleeson(4043)
Skin in the Game by Nassim Nicholas Taleb(3935)
The Money Culture by Michael Lewis(3786)
Bullshit Jobs by David Graeber(3783)
Skin in the Game: Hidden Asymmetries in Daily Life by Nassim Nicholas Taleb(3695)
The Wisdom of Finance by Mihir Desai(3490)
Blockchain Basics by Daniel Drescher(3292)
Liar's Poker by Michael Lewis(3191)
The Intelligent Investor by Benjamin Graham Jason Zweig(2904)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2900)
Mastering Bitcoin: Programming the Open Blockchain by Andreas M. Antonopoulos(2867)
Fooled by Randomness: The Hidden Role of Chance in Life and in the Markets by Nassim Nicholas Taleb(2833)
Investing For Dummies by Eric Tyson(2770)
The Power of Broke by Daymond John(2739)
Market Wizards by Jack D. Schwager(2518)
Zero Hour by Harry S. Dent Jr. & Andrew Pancholi(2511)
