O'Reilly logo

Python Machine Learning Cookbook by Prateek Joshi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Extracting statistics from time series data

One of the main reasons that we want to analyze time series data is to extract interesting statistics from it. This provides a lot of information regarding the nature of the data. In this recipe, we will take a look at how to extract these stats.

How to do it…

  1. Create a new Python file, and import the following packages:
    import numpy as np
    import pandas as pd
    import matplotlib.pyplot as plt
    
    from convert_to_timeseries import convert_data_to_timeseries
  2. We will use the same text file that we used in the previous recipes for analysis:
    # Input file containing data
    input_file = 'data_timeseries.txt'
  3. Load both the data columns (third and fourth columns):
    # Load data data1 = convert_data_to_timeseries(input_file, 2) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required