Skip to content

Instantly share code, notes, and snippets.

@zredlined
Created February 19, 2021 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zredlined/d1fcfbcb751d8a7c17a902093b090c86 to your computer and use it in GitHub Desktop.
Save zredlined/d1fcfbcb751d8a7c17a902093b090c86 to your computer and use it in GitHub Desktop.
# 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