From 819b49ef3c6eaad540226c382aab865660e7e78f Mon Sep 17 00:00:00 2001 From: jellyfishking-github <138719937+jellyfishking-github@users.noreply.github.com> Date: Thu, 13 Jul 2023 15:38:21 -0400 Subject: [PATCH] Update get.py --- braininventory/get.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/braininventory/get.py b/braininventory/get.py index b75f445..5746b7d 100644 --- a/braininventory/get.py +++ b/braininventory/get.py @@ -3,6 +3,24 @@ import json from datetime import date +import urllib.request +import matplotlib.pyplot as plt + + +url = 'https://download.brainimagelibrary.org/inventory/daily/reports/today.json' #get library +file_path, _ = urllib.request.urlretrieve(url) +df = pd.read_json(file_path) #the dataframe +items = df.affiliation #get the category affiliation +frequency = {} #add affiliation items here + +for item in items: + if item in frequency: + frequency[item] += 1 #if the item is already in frequency, then add one + else: + frequency[item] = 1 #if the item is not in the frequency, then add that item and set it to onbe + +print(frequency) + def today(): """ Get today's snapshot of Brain Image Library.