From 33febf4d5ae9cc85b290be6f7bcf959e009a6c9f Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 12:41:55 +0000 Subject: [PATCH] style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf This commit fixes the style issues introduced in 6972938 according to the output from Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf. Details: None --- data_analytics/data_analysis.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/data_analytics/data_analysis.py b/data_analytics/data_analysis.py index 20bc30414..88523a5c6 100644 --- a/data_analytics/data_analysis.py +++ b/data_analytics/data_analysis.py @@ -2,6 +2,7 @@ import pandas as pd from sklearn.cluster import KMeans + class DataAnalysis: def __init__(self, data): self.data = data @@ -9,16 +10,18 @@ def __init__(self, data): def analyze_data(self): # Perform data cleaning and preprocessing self.data = self.data.dropna() - self.data = pd.get_dummies(self.data, columns=['transaction_type']) + self.data = pd.get_dummies(self.data, columns=["transaction_type"]) # Perform data analysis - kmeans = KMeans(n_clusters=3, random_state=0).fit(self.data[['amount', 'frequency']]) - self.data['cluster'] = kmeans.labels_ + kmeans = KMeans(n_clusters=3, random_state=0).fit( + self.data[["amount", "frequency"]] + ) + self.data["cluster"] = kmeans.labels_ # Perform statistical analysis summary_stats = self.data.describe() - summary_stats.loc['count'] = len(self.data) - summary_stats.loc['mean'] = np.mean(self.data) - summary_stats.loc['std'] = np.std(self.data) + summary_stats.loc["count"] = len(self.data) + summary_stats.loc["mean"] = np.mean(self.data) + summary_stats.loc["std"] = np.std(self.data) return summary_stats