mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
isort --profile black --recursive . (#2170)
* isort --profile black --recursive . * Update codespell.yml * typo: vertices * typo: Explanation * typo: Explanation * Fix typos
This commit is contained in:
@ -250,7 +250,7 @@ def ReportGenerator(
|
||||
df["dummy"] = 1
|
||||
numeric_cols = df.select_dtypes(np.number).columns
|
||||
report = (
|
||||
df.groupby(["Cluster"])[ # constract report dataframe
|
||||
df.groupby(["Cluster"])[ # construct report dataframe
|
||||
numeric_cols
|
||||
] # group by cluster number
|
||||
.agg(
|
||||
@ -289,14 +289,14 @@ def ReportGenerator(
|
||||
|
||||
clustersize = report[
|
||||
(report["Features"] == "dummy") & (report["Type"] == "count")
|
||||
] # caclulating size of cluster(count of clientID's)
|
||||
] # calculate the size of cluster(count of clientID's)
|
||||
clustersize.Type = (
|
||||
"ClusterSize" # rename created cluster df to match report column names
|
||||
)
|
||||
clustersize.Features = "# of Customers"
|
||||
clusterproportion = pd.DataFrame(
|
||||
clustersize.iloc[:, 2:].values
|
||||
/ clustersize.iloc[:, 2:].values.sum() # caclulating proportion of cluster
|
||||
/ clustersize.iloc[:, 2:].values.sum() # calculating the proportion of cluster
|
||||
)
|
||||
clusterproportion[
|
||||
"Type"
|
||||
|
Reference in New Issue
Block a user