Created
February 19, 2021 06:00
-
-
Save zredlined/d1fcfbcb751d8a7c17a902093b090c86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load and preview dataset | |
import datetime | |
import pandas as pd | |
import numpy as np | |
day = 24 * 60 * 60 | |
year = 365.2425 * day | |
def load_dataframe() -> pd.DataFrame: | |
""" Create a time series x sin wave dataframe. """ | |
df = pd.DataFrame(columns=['date', 'sin']) | |
df.date = pd.date_range(start='2018-01-01', end='2021-03-01', freq='D') | |
df.sin = 1 + np.sin(df.date.astype('int64') // 1e9 * (2 * np.pi / year)) | |
df.sin = (df.sin * 100).round(2) | |
df.date = df.date.apply(lambda d: d.strftime('%Y-%m-%d')) | |
return df | |
train_df = load_dataframe() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment