Skip to content
Related Articles

Related Articles

Improve Article

Introduction to PyFlux in Python

  • Last Updated : 01 Aug, 2020

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:

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :