Operating on time series data
The Pandas library can operate on time series data efficiently and perform various operations like filtering and addition. Conditions can be set, and Pandas will filter the dataset and return the right subset based on the condition. Time series data can be loaded and filtered as well. Let's look at another example to illustrate this.
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 a Pandas DataFrame
object by naming the two dimensions:
# Create pandas dataframe for slicing
data = pd.DataFrame({'dim1': x1, 'dim2': x2})
Plot the data by specifying...