0% found this document useful (0 votes)
4 views2 pages

Time Series Analysis with Python

Uploaded by

John Jebakumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Time Series Analysis with Python

Uploaded by

John Jebakumar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

TIME SERIES ANALYSIS

import pandas as pd
import numpy as np
import [Link] as plt
from [Link] import seasonal_decompose
from [Link] import plot_acf, plot_pacf
from [Link] import adfuller

timestamps = pd.date_range(start="2025-03-01 00:00:00", periods=240, freq='h')

[Link](7)
values = (
100 + 0.1*[Link](240) + 8*[Link](2*[Link]*[Link]/24) +
[Link](0, 3, size=240) )

df = [Link]({"timestamp": timestamps, "value": values})

df.to_csv("/Users/lagisha/Desktop/power_data.csv", index=False)
print("New CSV created successfully on Desktop: power_data.csv")

df = pd.read_csv("/Users/lagisha/Desktop/power_data.csv", parse_dates=["timestamp"],
index_col="timestamp")

plt. gure( gsize=(12, 6))


[Link](df['value'], color='green')
[Link]('New Time Series Data (10 Days)')
[Link]('Time')
[Link]('Value')
[Link]()

result = seasonal_decompose(df['value'], model='additive', period=24)


[Link]()
[Link]()

plot_acf(df['value'], lags=50)
[Link]()
plot_pacf(df['value'], lags=50)
[Link]()

adf_result = adfuller(df['value'])
print("ADF Statistic:", adf_result[0])
print("p-value:", adf_result[1])
print("Critical Values:", adf_result[4])

if adf_result[1] < 0.05:


print("The series is stationary.")
else:
print(“ The series is not stationary.")
fi
fi
OUTPUT

You might also like