Skip to content

Commit 25b1c6f

Browse files
authored
Merge pull request #81 from brain-image-library/80-document-method-get_random_sample-using-chatgpt
80 document method get random sample using chatgpt
2 parents 4eef895 + 1d6541d commit 25b1c6f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

braininventory/get.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,28 @@ def __get_award_numbers(df):
262262

263263

264264
def __get_affiliations(df):
265-
return df["affiliation"].value_counts().to_dict()
265+
"""
266+
Return a dictionary containing the count of occurrences of each unique value
267+
in the "affiliation" column of the input DataFrame.
268+
269+
Parameters:
270+
-----------
271+
df : pandas DataFrame
272+
The input DataFrame containing a column named "affiliation" from which
273+
the unique values will be counted.
266274
275+
Returns:
276+
--------
277+
dict
278+
A dictionary where the keys represent unique values in the "affiliation"
279+
column, and the values represent the count of occurrences of each unique value.
280+
281+
Note:
282+
-----
283+
The input DataFrame `df` should have a column named "affiliation" containing
284+
categorical data, where the function will count the occurrences of each unique value.
285+
"""
286+
return df["affiliation"].value_counts().to_dict()
267287

268288
def __get_contributors(df):
269289
return df["contributorname"].value_counts().to_dict()

0 commit comments

Comments
 (0)