Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions models/data_processing/data_analytics.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Import necessary libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns

# Define a class for data analysis and visualization


class DataAnalytics:
def __init__(self, data_path):
# Load data from file
Expand All @@ -17,7 +19,7 @@ def summary_statistics(self):
def correlation_matrix(self):
# Compute the correlation matrix for the data
corr = self.data.corr()
sns.heatmap(corr, annot=True, cmap='coolwarm')
sns.heatmap(corr, annot=True, cmap="coolwarm")
plt.show()

def scatter_plot(self, x_column, y_column):
Expand All @@ -29,21 +31,21 @@ def scatter_plot(self, x_column, y_column):

def bar_plot(self, column):
# Create a bar plot for a column of the data
self.data[column].value_counts().plot(kind='bar')
self.data[column].value_counts().plot(kind="bar")
plt.xlabel(column)
plt.ylabel('Count')
plt.ylabel("Count")
plt.show()

def line_plot(self, column):
# Create a line plot for a column of the data
plt.plot(self.data[column])
plt.xlabel('Index')
plt.xlabel("Index")
plt.ylabel(column)
plt.show()

def histogram_plot(self, column):
# Create a histogram plot for a column of the data
plt.hist(self.data[column])
plt.xlabel(column)
plt.ylabel('Count')
plt.ylabel("Count")
plt.show()