Friday, June 30, 2017

Simple code to generate synthetic time series data in Python / Pandas

Here is a simple code to generate synthetic time series.

import numpy as np
import pandas as pd

med = 15.5
dp = 8.2
sDays = np.arange('2001-01', '2016-12', dtype='datetime64[D]')
nDays = len(sDays)

s1 = np.random.gumbel(loc=med,scale=dp,size=nDays)
s1[s1 < 0] = 0

dfSint = pd.DataFrame({'Q':s1},index=sDays)
dfSint.plot()

4 comments:

  1. Replies
    1. Of course! this is a simple code to denerate random values, following gumbel statistical distribution, with known average and standard deviation

      Delete
  2. Really good information to show through this blog. I really appreciate you for all the valuable information that you are providing us through your blog. python Online course

    ReplyDelete
  3. Thanks for sharing amazing information about python .Gain the knowledge and hands-on experience in python Online Training

    ReplyDelete