Python for Finance: Analyze Big Financial Data
Chapter 4. Data Types and Structures Bad programmers worry about the code. Good programmers worry about d ...
Basic Data Types Python is a dynamically typed language, which means that the Python interpreter infers the ...
The following expression yields the expected result: In [ 6 ]: 1 + 4 Out[6]: 5 However, the next case m ...
all platforms that Python runs on use the IEEE 754 double-precision standard (i.e., 64 bits), for interna ...
In [ 24 ]: t.capitalize() Out[24]: ‘This is a string object’ Or you can split it into its single-word components ...
split ([sep[, maxsplit]]) List of words in string with sep as separator splitlines ([keepends]) Separated lines ...
Out[35]: 2014-01-18 13:00:00 In [ 36 ]: print type(pydt) Out[36]: <type ‘datetime.datetime’> Later chapters ...
Basic Data Structures As a general rule, data structures are objects that contain a possibly large number ...
Objects of type list are much more flexible and powerful in comparison to tuple objects. From a f ...
append (x) Appends x to object count (x) Number of occurrences of object x del l[i:j:k] [i:j:k] Deletes ...
In [ 55 ]: for i in range( 2 , 5 ): print l[i] ** 2 Out[55]: 6.25 1.0 ...
Out[60]: False The return object is a Boolean. Such a function can be applied to a whole list obj ...
In [ 68 ]: d.keys() Out[68]: [‘Country’, ‘Age’, ‘Profession’, ‘Name’] In [ 69 ]: d.values() Out[69]: [‘Germany’, 60, ...
iterkeys () Iterator over all keys itervalues () Iterator over all values keys () Copy of all keys poptiem (k) Returns ...
NumPy Data Structures The previous section shows that Python provides some quite useful and flexible ...
In [ 89 ]: c[ 1 ][ 1 ][ 0 ] Out[89]: 1 Note that combining objects in the way just presented generally works ...
In [ 98 ]: a.std() # standard deviation Out[98]: 0.70710678118654757 In [ 99 ]: a.cumsum() # running cumula ...
[[ 1.0, 1.0, 1.0, 1.0], [ 1.0, 1.0, 1.0, 1.0], ...
U Unicode U24 (24 Unicode characters) V Other V12 (12-byte data block) NumPy provides a generalization of regu ...
Structured Arrays The specialization of the numpy.ndarray class obviously brings a number of really valuable ...
«
1
2
3
4
5
6
7
8
9
10
»
Free download pdf