Python for Finance: Analyze Big Financial Data
Vectorization of Code Vectorization of code is a strategy to get more compact code that is possibly ...
As a general rule, custom-defined Python functions work with numpy.ndarrays as well. If the implementation ...
small arrays, this has hardly any measurable impact on the performance of array operations. However, when arra ...
Conclusions Python provides, in combination with NumPy, a rich set of flexible data structures. From a fin ...
Further Reading This chapter focuses on those issues that might be of particular importance for finance algorithm ...
Chapter 5. Data Visualization Use a picture. It’s worth a thousand words. — Arthur Brisbane (1911) Th ...
Two-Dimensional Plotting To begin with, we have to import the respective libraries. The main plotting function ...
Figure 5-2. Plot given data as 1D array NUMPY ARRAYS AND MATPLOTLIB You can simply pass NumPy ndarray o ...
Figure 5-4. Plot with grid and tight axes Other options for plt.axis are given in Table 5-1, the ma ...
Figure 5-5. Plot with custom axis limits For the sake of better readability, a plot usually cont ...
g Green r Red c Cyan m Magenta y Yellow k Black w White In terms of line and/or point styles, plt.plot supports t ...
< Triangle_left marker > Triangle_right marker 1 Tri_down marker 2 Tri_up marker 3 Tri_left marker 4 Tri_right m ...
Plotting one-dimensional data can be considered a special case. In general, data sets will consist of m ...
plt.plot(y, ‘ro’) plt.grid(True) plt.legend(loc= 0 ) plt.axis(‘tight’) plt.xlabel(‘index’) plt.ylabel(‘value’) plt.title(‘A S ...
Figure 5-8. Plot with labeled data sets Multiple data sets with a similar scaling, like simula ...
Use of two subplots (upper/lower, left/right) Let us first introduce a second y-axis into the plot. Fi ...
plt.grid(True) plt.legend(loc= 0 ) plt.axis(‘tight’) plt.xlabel(‘index’) plt.ylabel(‘value’) Figure 5-11. Plot with t ...
Figure 5-12. Plot combining line/point subplot with bar subplot Other Plot Styles When it comes to two- ...
matplotlib also provides a specific function to generate scatter plots. It basically works in the sam ...
Figure 5-15. Scatter plot with third dimension Another type of plot, the histogram, is also often u ...
«
1
2
3
4
5
6
7
8
9
10
»
Free download pdf