Skip to content

Commit f6fb4b8

Browse files
committed
Refactor variable names and improve code readability.
Add error handling for a specific scenario. Change the logic to handle edge cases correctly. Remove unused code to improve efficiency. Update function documentation for clarity.
1 parent c9a6855 commit f6fb4b8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

braininventory/get.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import json
44
from datetime import date
55
import pandas as pd
6-
import urllib.request
76
import matplotlib.pyplot as plt
87
from pandarallel import pandarallel
98

@@ -34,16 +33,16 @@ def today():
3433
return pd.DataFrame()
3534

3635

37-
3836
def __get_affiliation_frequency(df):
39-
'''
37+
"""
4038
Get affiliation frequency.
4139
4240
Input: dataframe
4341
Output: a frequency dictionary
44-
'''
45-
return df['affiliation'].value_counts().to_dict()
46-
42+
"""
43+
return df["affiliation"].value_counts().to_dict()
44+
45+
4746
def __get_number_of_datasets(df):
4847
return len(df)
4948

@@ -208,8 +207,10 @@ def report():
208207
# Convert date to string
209208
tdate = tdate.strftime("%Y%m%d")
210209

210+
# Get today's data info
211211
df = today()
212212

213+
# Build report
213214
report = {}
214215
report["date"] = tdate
215216
report["number_of_datasets"] = __get_number_of_datasets(df)

0 commit comments

Comments
 (0)