Skip to content

Commit

Permalink
style: format code with Autopep8, Black, ClangFormat, dotnet-format, …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
deepsource-autofix[bot] authored May 10, 2024
1 parent 7fb3d57 commit 33febf4
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions data_analytics/data_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@
import pandas as pd
from sklearn.cluster import KMeans


class DataAnalysis:
def __init__(self, data):
self.data = 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

0 comments on commit 33febf4

Please sign in to comment.