<jupyter_start><jupyter_text>Hands-on Time Series Analysis with Python![](https://github.com/Apress/hands-on-time-series-analylsis-python/raw/master/9781484259917.jpg)<jupyter_code>import IPython.display

IPython.display.Markdown('https://github.com/Apress/hands-on-time-series-analylsis-python/raw/master/README.md')<jupyter_output><empty_output><jupyter_text>Time-Series CharacteristicsA time series is a collection of data points that are stored with respect to their time. Mathematical and statistical analysis performed on this kind of data to find hidden patterns and meaningful insight is called time series analysis. TrendA trend is a pattern that is observed over a period of time and represents the mean rate of change with respect to time. A trend usually shows the tendency of the data to increase/uptrend or decrease/downtrend during the long run. Detecting Trend Using a Hodrick-Prescott FilterThe Hodrick-Prescott (HP) filter has become a benchmark for getting rid of trend movements in data. This method is broadly employed for econometric methods in applied macroeconomics research. The technique is nonparametric and is used to dissolve a time series into a trend; it is a cyclical component unaided by economic theory or prior trend specification. Like all nonparametric methods, the HP filter is contingent significantly on a tuning parameter that controls the degree of smoothing. This method is broadly employed in applied macroeconomics utilized in central banks, international economics agencies, industry, and government.<jupyter_code>import pandas as pd
from statsmodels.tsa.filters.hp_filter import hpfilter

df = pd.read_excel('https://raw.githubusercontent.com/Apress/hands-on-time-series-analylsis-python/master/Data/India_Exchange_Rate_Dataset.xls', index_col=0, parse_dates=True)

df.info()
df
df.plot(figsize=(15,6)).autoscale(axis='x',tight=True)
EXINUS_cycle, EXINUS_trend = hpfilter(df['EXINUS'], lamb=1600)
EXINUS_trend.plot(figsize=(15,6)).autoscale(axis='x',tight=True)
EXINUS_cycle<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07508532423208192, 'fraction_numerical': 0.011701608971233545, 'mean_word_length': 6.276595744680851, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 3, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '609675', 'license': 'MIT', 'n_tokens_mistral': 605, 'n_tokens_neox': 565, 'n_words': 207, 'path': 'hands-on-time-series-analylsis-python.ipynb', 'repo_name': 'loosak/pysnippets', 'size': '2051'}