3
$\begingroup$

can anyone please offer suggestions on ways to programmatically generate time series data artificially. if possible, mimic the distribution of an existing dataset (say hourly humidity readings) and add some noise if required. Any suggestions will be greatly appreciated!

$\endgroup$
2
1
$\begingroup$

This article is great to generate time series data in python. Hope this helps.

https://towardsdatascience.com/basic-time-series-manipulation-with-pandas-4432afee64ea

$\endgroup$
2
  • $\begingroup$ thanks but the link describes handling time series data not generating time series data.. $\endgroup$
    – Chidi
    Jun 28 '19 at 14:02
  • $\begingroup$ This answer is not at all heplful. $\endgroup$
    – rjurney
    Sep 23 '20 at 17:29
1
$\begingroup$
import pandas as pd
from datetime import datetime
import numpy as np
date_rng = pd.date_range(start='1/1/2018', end='1/08/2018', freq='H')

This is generating a time stamp, hourly data

type(date_rng)

pandas.core.indexes.datetimes.DatetimeIndex

Create a dataframe and add random values for the corresponding date

df = pd.DataFrame(date_rng, columns=['date'])
df['data'] = np.random.randint(0,100,size=(len(date_rng)))

You have your self-generated time-series data. Hope this one helps.

$\endgroup$
1
  • 2
    $\begingroup$ He wants to mimic existing data. $\endgroup$
    – rjurney
    Sep 23 '20 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.