Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Simple Time Series | Time Series Visualization
Time Series Analysis
course content

Зміст курсу

Time Series Analysis

Time Series Analysis

1. Time Series: Let's Start
2. Time Series Processing
3. Time Series Visualization
4. Stationary Models
5. Non-Stationary Models
6. Solve Real Problems

bookSimple Time Series

The role of visualization in time series analysis has already been demonstrated to you in the previous section. An expert's glance at the chart may be enough to understand whether the data is stationary or not, what main patterns are present in it, etc.

Despite this, it is important to remember that an expert's assessment is not accurate, and we still recommend using formal methods (tests) to analyze your data.

You already know how to implement 2D visualization:

But let's take as an example a situation where we need to take into account 2 or 3 variables that change over time. For example, you have an online store and a pricing task for which you use competitor pricing data. You take on your 2 main competitors. See how you can put several time series on one graph at once:

What the data looks like in the dataset:

Also, you can implement it in the following way through a loop:

If you have a large amount of data (for example, you want to explore more than 20 competitors), you may have problems with the analysis of the resulting graph:

Then, you can use the seaborn library, which allows you to compare multiple graphs with each other:

12345678910111213141516171819202122
import seaborn as sns sns.set_theme(style="dark") flights = sns.load_dataset("flights") g = sns.relplot( data=flights, x="month", y="passengers", col="year", hue="year", kind="line", palette="crest", linewidth=4, zorder=5, col_wrap=3, height=2, aspect=1.5, legend=False, ) for year, ax in g.axes_dict.items(): ax.text(.8, .85, year, transform=ax.transAxes, fontweight="bold") sns.lineplot( data=flights, x="month", y="passengers", units="year", estimator=None, color=".7", linewidth=1, ax=ax, ) ax.set_xticks(ax.get_xticks()[::2]) g.set_axis_labels("", "Passengers") g.tight_layout()
copy

Завдання

Plot the flights.csv dataset, which contains flight data from 1949 to 1960, every month.

  1. Save months names within the all_months variable. Months names are df column names.
  2. Iterate over each available year in the data. Years are indexes of the df dataframe.
  3. Within the loop, filter to iterated year data (using the .iloc[] property and the n variable), and save them within the year_row variable.
  4. Within the loop, initialize a line plot with months labels (all_months) on the x-axis, respective data (year_row) on the y-axis, and set label parameter to iterated year.
  5. Display the legend of the plot.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 1
toggle bottom row

bookSimple Time Series

The role of visualization in time series analysis has already been demonstrated to you in the previous section. An expert's glance at the chart may be enough to understand whether the data is stationary or not, what main patterns are present in it, etc.

Despite this, it is important to remember that an expert's assessment is not accurate, and we still recommend using formal methods (tests) to analyze your data.

You already know how to implement 2D visualization:

But let's take as an example a situation where we need to take into account 2 or 3 variables that change over time. For example, you have an online store and a pricing task for which you use competitor pricing data. You take on your 2 main competitors. See how you can put several time series on one graph at once:

What the data looks like in the dataset:

Also, you can implement it in the following way through a loop:

If you have a large amount of data (for example, you want to explore more than 20 competitors), you may have problems with the analysis of the resulting graph:

Then, you can use the seaborn library, which allows you to compare multiple graphs with each other:

12345678910111213141516171819202122
import seaborn as sns sns.set_theme(style="dark") flights = sns.load_dataset("flights") g = sns.relplot( data=flights, x="month", y="passengers", col="year", hue="year", kind="line", palette="crest", linewidth=4, zorder=5, col_wrap=3, height=2, aspect=1.5, legend=False, ) for year, ax in g.axes_dict.items(): ax.text(.8, .85, year, transform=ax.transAxes, fontweight="bold") sns.lineplot( data=flights, x="month", y="passengers", units="year", estimator=None, color=".7", linewidth=1, ax=ax, ) ax.set_xticks(ax.get_xticks()[::2]) g.set_axis_labels("", "Passengers") g.tight_layout()
copy

Завдання

Plot the flights.csv dataset, which contains flight data from 1949 to 1960, every month.

  1. Save months names within the all_months variable. Months names are df column names.
  2. Iterate over each available year in the data. Years are indexes of the df dataframe.
  3. Within the loop, filter to iterated year data (using the .iloc[] property and the n variable), and save them within the year_row variable.
  4. Within the loop, initialize a line plot with months labels (all_months) on the x-axis, respective data (year_row) on the y-axis, and set label parameter to iterated year.
  5. Display the legend of the plot.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 1
toggle bottom row

bookSimple Time Series

The role of visualization in time series analysis has already been demonstrated to you in the previous section. An expert's glance at the chart may be enough to understand whether the data is stationary or not, what main patterns are present in it, etc.

Despite this, it is important to remember that an expert's assessment is not accurate, and we still recommend using formal methods (tests) to analyze your data.

You already know how to implement 2D visualization:

But let's take as an example a situation where we need to take into account 2 or 3 variables that change over time. For example, you have an online store and a pricing task for which you use competitor pricing data. You take on your 2 main competitors. See how you can put several time series on one graph at once:

What the data looks like in the dataset:

Also, you can implement it in the following way through a loop:

If you have a large amount of data (for example, you want to explore more than 20 competitors), you may have problems with the analysis of the resulting graph:

Then, you can use the seaborn library, which allows you to compare multiple graphs with each other:

12345678910111213141516171819202122
import seaborn as sns sns.set_theme(style="dark") flights = sns.load_dataset("flights") g = sns.relplot( data=flights, x="month", y="passengers", col="year", hue="year", kind="line", palette="crest", linewidth=4, zorder=5, col_wrap=3, height=2, aspect=1.5, legend=False, ) for year, ax in g.axes_dict.items(): ax.text(.8, .85, year, transform=ax.transAxes, fontweight="bold") sns.lineplot( data=flights, x="month", y="passengers", units="year", estimator=None, color=".7", linewidth=1, ax=ax, ) ax.set_xticks(ax.get_xticks()[::2]) g.set_axis_labels("", "Passengers") g.tight_layout()
copy

Завдання

Plot the flights.csv dataset, which contains flight data from 1949 to 1960, every month.

  1. Save months names within the all_months variable. Months names are df column names.
  2. Iterate over each available year in the data. Years are indexes of the df dataframe.
  3. Within the loop, filter to iterated year data (using the .iloc[] property and the n variable), and save them within the year_row variable.
  4. Within the loop, initialize a line plot with months labels (all_months) on the x-axis, respective data (year_row) on the y-axis, and set label parameter to iterated year.
  5. Display the legend of the plot.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

The role of visualization in time series analysis has already been demonstrated to you in the previous section. An expert's glance at the chart may be enough to understand whether the data is stationary or not, what main patterns are present in it, etc.

Despite this, it is important to remember that an expert's assessment is not accurate, and we still recommend using formal methods (tests) to analyze your data.

You already know how to implement 2D visualization:

But let's take as an example a situation where we need to take into account 2 or 3 variables that change over time. For example, you have an online store and a pricing task for which you use competitor pricing data. You take on your 2 main competitors. See how you can put several time series on one graph at once:

What the data looks like in the dataset:

Also, you can implement it in the following way through a loop:

If you have a large amount of data (for example, you want to explore more than 20 competitors), you may have problems with the analysis of the resulting graph:

Then, you can use the seaborn library, which allows you to compare multiple graphs with each other:

12345678910111213141516171819202122
import seaborn as sns sns.set_theme(style="dark") flights = sns.load_dataset("flights") g = sns.relplot( data=flights, x="month", y="passengers", col="year", hue="year", kind="line", palette="crest", linewidth=4, zorder=5, col_wrap=3, height=2, aspect=1.5, legend=False, ) for year, ax in g.axes_dict.items(): ax.text(.8, .85, year, transform=ax.transAxes, fontweight="bold") sns.lineplot( data=flights, x="month", y="passengers", units="year", estimator=None, color=".7", linewidth=1, ax=ax, ) ax.set_xticks(ax.get_xticks()[::2]) g.set_axis_labels("", "Passengers") g.tight_layout()
copy

Завдання

Plot the flights.csv dataset, which contains flight data from 1949 to 1960, every month.

  1. Save months names within the all_months variable. Months names are df column names.
  2. Iterate over each available year in the data. Years are indexes of the df dataframe.
  3. Within the loop, filter to iterated year data (using the .iloc[] property and the n variable), and save them within the year_row variable.
  4. Within the loop, initialize a line plot with months labels (all_months) on the x-axis, respective data (year_row) on the y-axis, and set label parameter to iterated year.
  5. Display the legend of the plot.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 3. Розділ 1
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
some-alt