Skip to content

Commit 1be9665

Browse files
authored
Update get.py
1 parent 8f72097 commit 1be9665

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

braininventory/get.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,24 @@ def __get_number_of_projects(df):
128128

129129
return len(df["project"].unique())
130130

131+
import squarify
132+
import urllib.request
133+
import matplotlib.pyplot as plt
134+
import pandas as pd
135+
136+
url = 'https://download.brainimagelibrary.org/inventory/daily/reports/today.json'
137+
file_path, _ = urllib.request.urlretrieve(url)
138+
df = pd.read_json(file_path)
139+
140+
def get_projects_treemaps(df):
141+
df = df['project'].value_counts().to_dict()
142+
sizes_list = list(df.values())
143+
names_list = list(df.keys())
144+
squarify.plot(sizes_list)
145+
plt.show()
146+
get_projects_treemaps(df)
147+
148+
131149
def report():
132150
# Get today's date
133151
tdate = date.today()

0 commit comments

Comments
 (0)