mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +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:
parent
25d9d819a2
commit
cd3e8f95a0
3
.github/workflows/autoblack.yml
vendored
3
.github/workflows/autoblack.yml
vendored
@ -11,12 +11,13 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v1 # Use v1, NOT v2
|
||||
- uses: actions/setup-python@v2
|
||||
- run: pip install black
|
||||
- run: pip install black isort
|
||||
- run: black --check .
|
||||
- name: If needed, commit black changes to a new pull request
|
||||
if: failure()
|
||||
run: |
|
||||
black .
|
||||
isort --profile black --recursive .
|
||||
git config --global user.name github-actions
|
||||
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
|
||||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
||||
|
4
.github/workflows/codespell.yml
vendored
4
.github/workflows/codespell.yml
vendored
@ -13,5 +13,5 @@ jobs:
|
||||
SKIP="./.*,./other/dictionary.txt,./other/words,./project_euler/problem_22/p022_names.txt"
|
||||
codespell -L ans,fo,hist,iff,secant,tim --skip=$SKIP --quiet-level=2
|
||||
- name: Codespell comment
|
||||
if: ${{ failure() }}
|
||||
uses: plettich/python_codespell_action@master
|
||||
if: ${{ failure() }}
|
||||
uses: plettich/python_codespell_action@master
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Video Explaination: https://www.youtube.com/watch?v=6w60Zi1NtL8&feature=emb_logo
|
||||
# Video Explanation: https://www.youtube.com/watch?v=6w60Zi1NtL8&feature=emb_logo
|
||||
|
||||
from typing import List
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Youtube Explaination: https://www.youtube.com/watch?v=lBRtnuxg-gU
|
||||
# Youtube Explanation: https://www.youtube.com/watch?v=lBRtnuxg-gU
|
||||
|
||||
from typing import List
|
||||
|
||||
|
@ -12,7 +12,7 @@ test_graph_2 = {0: [1, 2, 3], 1: [0, 3], 2: [0], 3: [0, 1], 4: [], 5: []}
|
||||
|
||||
def dfs(graph: dict, vert: int, visited: list) -> list:
|
||||
"""
|
||||
Use depth first search to find all vertexes
|
||||
Use depth first search to find all vertices
|
||||
being in the same component as initial vertex
|
||||
>>> dfs(test_graph_1, 0, 5 * [False])
|
||||
[0, 1, 3, 2]
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user