Operating on time-series data

Pandas allows us to operate on time-series data efficiently and perform various operations like filtering and addition. You can simply set some conditions and Pandas will filter the dataset and return the right subset. You can add two time-series variables as well. This allows us to build various applications quickly without having to reinvent the wheel.

Create a new Python file and import the following packages:

import numpy as np 
import pandas as pd 
import matplotlib.pyplot as plt 
 
from timeseries import read_data  

Define the input filename:

# Input filename 
input_file = 'data_2D.txt' 

Load the third and fourth columns into separate variables:

# Load data 
x1 = read_data(input_file, 2) 
x2 = read_data(input_file, 3) 

Create ...

Get Artificial Intelligence with Python 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.