Created
April 23, 2025 10:17
-
-
Save carloocchiena/fdc7f497020399a8ed667890fa52d98c 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
# Add useful time-based features | |
df['Hour'] = df.index.hour | |
df['Day'] = df.index.day | |
df['Weekday'] = df.index.weekday # Monday=0, Sunday=6 | |
df['Month'] = df.index.month | |
df['Date'] = df.index.date # useful for grouping by day | |
plt.figure(figsize=(10, 4)) | |
sns.histplot(df['Value'], bins=50, kde=True) | |
plt.title('Distribution of values') | |
plt.xlabel('Value') | |
plt.ylabel('Frequency') | |
plt.grid(True) | |
plt.tight_layout() | |
plt.show() | |
plt.figure(figsize=(12, 5)) | |
sns.boxplot(data=df, x='Hour', y='Value') | |
plt.title('Hourly Distribution of Values') | |
plt.xlabel('Hour of Day') | |
plt.ylabel('Value') | |
plt.grid(True) | |
plt.tight_layout() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment