Book Image

Python Data Analysis - Second Edition

By : Ivan Idris
Book Image

Python Data Analysis - Second Edition

By: Ivan Idris

Overview of this book

Data analysis techniques generate useful insights from small and large volumes of data. Python, with its strong set of libraries, has become a popular platform to conduct various data analysis and predictive modeling tasks. With this book, you will learn how to process and manipulate data with Python for complex analysis and modeling. We learn data manipulations such as aggregating, concatenating, appending, cleaning, and handling missing values, with NumPy and Pandas. The book covers how to store and retrieve data from various data sources such as SQL and NoSQL, CSV fies, and HDF5. We learn how to visualize data using visualization libraries, along with advanced topics such as signal processing, time series, textual data analysis, machine learning, and social media analysis. The book covers a plethora of Python modules, such as matplotlib, statsmodels, scikit-learn, and NLTK. It also covers using Python with external environments such as R, Fortran, C/C++, and Boost libraries.
Table of Contents (22 chapters)
Python Data Analysis - Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
Key Concepts
Online Resources

Matplotlib


The following are useful matplotlib functions:

matplotlib.pyplot.axis(*v, **kwargs): This is the method to get or set axis properties. For example, axis('off') turns off the axis lines and labels.

matplotlib.pyplot.figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True, FigureClass=<class 'matplotlib.figure.Figure'>, **kwargs): This function creates a new figure.

matplotlib.pyplot.grid(b=None, which='major', axis='both', **kwargs): This function turns the plot grids on or off.

matplotlib.pyplot.hist(x, bins=10, range=None, normed=False, weights=None, cumulative=False, bottom=None, histtype='bar', align='mid', orientation='vertical', rwidth=None, log=False, color=None, label=None, stacked=False, hold=None, **kwargs): This function plots a histogram.

matplotlib.pyplot.imshow(X, cmap=None, norm=None, aspect=None, interpolation=None, alpha=None, vmin=None, vmax=None, origin=None, extent=None, shape=None, filternorm=1, filterrad=4.0, imlim=None, resample=None, url=None, hold=None, **kwargs): This function displays an image for array-like data.

matplotlib.pyplot.legend(*args, **kwargs): This function shows a legend at an optionally specified location (for instance, plt.legend(loc='best')).

matplotlib.pyplot.plot(*args, **kwargs): This function creates a two-dimensional plot with single or multiple (x, y) pairs and a corresponding optional format string.

matplotlib.pyplot.scatter(x, y, s=20, c='b', marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, verts=None, hold=None, **kwargs): This function creates a scatter plot of two arrays.

matplotlib.pyplot.show(*args, **kw): This function displays a plot.

matplotlib.pyplot.subplot(*args, **kwargs): This function creates subplots if the row number, column number, and index number of the plot are given. All these numbers start from one. For instance, plt.subplot(221) creates the first subplot in a two-by-two grid.

matplotlib.pyplot.title(s, *args, **kwargs): This function puts a title on the plot.