<jupyter_start><jupyter_text>Time Series Feature Engineering> Time series feature generator.  Install `pip install timeseries_feature_engineering`  How to use  Add Date Parts<jupyter_code>df = pd.DataFrame({'date': ['2019-12-04', None, '2019-11-15', '2019-10-24']})
df = add_datepart(df, 'date')
df.head()<jupyter_output><empty_output><jupyter_text>Add Moving Average FeaturesWith weighted average. > Recency in an important factor in a time series. Values closer to the current date would hold more information.<jupyter_code>df = pd.DataFrame({
    'date': pd.date_range('2019-12-01', '2019-12-10'), 
    'sales': np.random.randint(100, 500, size=10)
})
df = add_moving_average_features(df, 'sales', windows=[3,5], weighted=True)
df.head(10)<jupyter_output><empty_output><jupyter_text>Without weighted average.<jupyter_code>df = pd.DataFrame({
    'date': pd.date_range('2019-12-01', '2019-12-10'), 
    'sales': np.random.randint(100, 500, size=10)
})
df = add_moving_average_features(df, 'sales', windows=[3,5], weighted=True)
df.head(10)<jupyter_output><empty_output><jupyter_text>Add Expanding Features<jupyter_code>df = pd.DataFrame({
    'date': pd.date_range('2019-12-01', '2019-12-10'), 
    'sales': np.random.randint(100, 500, size=10)
})
df = add_expanding_features(df, 'sales', period=3)
df.head()<jupyter_output><empty_output><jupyter_text>Add Trend Features<jupyter_code>df = pd.DataFrame({
    'date': pd.date_range('2019-12-01', '2019-12-10'), 
    'sales': np.random.randint(100, 500, size=10)
})
df = add_trend_features(df, 'sales', windows=[3,7])
df.head(10)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1685323383084577, 'fraction_numerical': 0.08271144278606965, 'mean_word_length': 6.518691588785047, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '131752', 'license': 'Apache-2.0', 'n_tokens_mistral': 705, 'n_tokens_neox': 593, 'n_words': 111, 'path': 'index.ipynb', 'repo_name': 'shanaka-desoysa/timeseries_feature_engineering', 'size': '1608'}