Evolution over time

When working with time series (such as the Facebook stock data), we often want to show how data has changed over time. To do this, we use line plots and, in some cases, bar plots (covered in the Counts and frequencies section). In the case of a line plot, we simply provide kind='line' to plot(), indicating which columns will be x and y. We don't need to provide a column for x because pandas will use the index (this also makes it possible to generate the line plot of a Series object). Additionally, notice that we can provide a format string to the style argument just as we did with the matplotlib plots:

>>> fb.plot(...     kind='line', ...     y='open', ...     figsize=(10, 5), ...     style='b-',...     legend=False,... title='Evolution of ...

Get Hands-On Data Analysis with Pandas now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.