Open In App

Introduction to PyFlux in Python

Improve
Improve
Like Article
Like
Save
Share
Report

We all are well aware of the various types of libraries Python has to offer. We’ll be telling you about one such library knows as PyFlux. The most frequently encountered problems in the Machine learning domain is Time series analysis.

PyFlux is an open-source library in Python explicitly built for working with statistic problems. The library has a superb array of recent statistic models. PyFlux also enables users to have a probabilistic approach the advantage with that is that it gives a more complete picture of uncertainty, which is important for time series tasks such as forecasting.

Installation

The latest release of PyFlux is supported on Python 3.5.

pip install pyflux

Application Interface

The PyFlux API is so concise that it takes a minimal number of steps to conduct the model building process.

Example 1: Getting Started with Time Series

Python3




import pandas as pd
import datetime
from pandas import Series, DataFrame
import pandas_datareader
import pandas_datareader.data as web
import pyflux as pf
import matplotlib.pyplot as plt
  
  
pandas_datareader.__version__
  
start = datetime.datetime(2009, 1, 1)
end = datetime.datetime(2019, 1, 1)
df = web.DataReader('T', "yahoo", start, end)
  
print(df.head())
df.info()


Output:

Example 2: Visualize the Data 

Python3




plt.figure(figsize=(15, 5))
plt.ylabel("Returns")
plt.plot(df)
plt.show()


Output:



Last Updated : 01 Aug, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads