Skip to content

Commit 1696d98

Browse files
authored
Update get.py
1 parent a510fa0 commit 1696d98

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

braininventory/get.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,3 +1410,16 @@ def create_tree_map(frequency_dict, width, height):
14101410
output_path = f'treemap-{today.strftime("%Y%m%d")}.png'
14111411
fig.write_image(output_path)
14121412
fig.show()
1413+
1414+
def __get_dates():
1415+
"""
1416+
Get a dictionary that has keys as creation months and values as the number of datasets
1417+
1418+
Input: dataframe
1419+
1420+
Output: dictionary
1421+
"""
1422+
df['date'] = pd.to_datetime(df['creation_date'], format='%a %b %d %H:%M:%S %Y')
1423+
df['year_month'] = df['date'].dt.strftime('%B %Y')
1424+
grouped_data = df['year_month'].value_counts().to_dict()
1425+
return grouped_data

0 commit comments

Comments
 (0)