-
-
Save OEIRU/03ee4adb58cc2b083d67f0dc7137303d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| # Загрузка данных из текстовых файлов | |
| file1 = 'file1.txt' | |
| file2 = 'file2.txt' | |
| file3 = 'file3.txt' | |
| # Чтение данных в DataFrame | |
| data1 = pd.read_csv(file1, header=None) | |
| data2 = pd.read_csv(file2, header=None) | |
| data3 = pd.read_csv(file3, header=None) | |
| # Применение скользящего среднего для сглаживания | |
| window_size = 5 # Размер окна для скользящего среднего | |
| smoothed_data1 = data1.rolling(window=window_size).mean() | |
| smoothed_data2 = data2.rolling(window=window_size).mean() | |
| smoothed_data3 = data3.rolling(window=window_size).mean() | |
| # Построение графика | |
| plt.figure(figsize=(10, 6)) | |
| plt.plot(smoothed_data1, label='Файл 1 (сглаженный)', marker='o') | |
| plt.plot(smoothed_data2, label='Файл 2 (сглаженный)', marker='x') | |
| plt.plot(smoothed_data3, label='Файл 3 (сглаженный)', marker='s') | |
| plt.title('Сглаженный график из трех файлов') | |
| plt.xlabel('Индекс') | |
| plt.ylabel('Значение') | |
| plt.legend() | |
| plt.grid() | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment