Skip to content

Commit ba9b14d

Browse files
authored
Merge pull request #37 from brain-image-library/27-frequency-of-affiliation
27 frequency of affiliation
2 parents 7e83841 + f6fb4b8 commit ba9b14d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

braininventory/get.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import pandas as pd
33
import json
44
from datetime import date
5+
import pandas as pd
6+
import matplotlib.pyplot as plt
57
from pandarallel import pandarallel
68

79
pandarallel.initialize(nb_workers=8, progress_bar=True)
@@ -31,6 +33,16 @@ def today():
3133
return pd.DataFrame()
3234

3335

36+
def __get_affiliation_frequency(df):
37+
"""
38+
Get affiliation frequency.
39+
40+
Input: dataframe
41+
Output: a frequency dictionary
42+
"""
43+
return df["affiliation"].value_counts().to_dict()
44+
45+
3446
def __get_number_of_datasets(df):
3547
return len(df)
3648

@@ -195,8 +207,10 @@ def report():
195207
# Convert date to string
196208
tdate = tdate.strftime("%Y%m%d")
197209

210+
# Get today's data info
198211
df = today()
199212

213+
# Build report
200214
report = {}
201215
report["date"] = tdate
202216
report["number_of_datasets"] = __get_number_of_datasets(df)

0 commit comments

Comments
 (0)