File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 6
6
def get_jsonFile (df ):
7
7
"""
8
8
Input: dataframe
9
- Expected Output: link that opens the jsonFile that was located in the randomly chosen row
10
- Current Output: broken link resulting in Error 404 on the webpage
9
+ Output:open the jsonFile that was located in datasets Brain Image Library dataframe
11
10
"""
12
- isNotZero = df [df ["score" ] != 0.0 ] #only select rows != 0
13
- randomRow = isNotZero .iloc [random .randint (0 , len (isNotZero ))] #select a random row of random index bt 0 and len of isNotZero
14
- jsonFile = randomRow .json_file .replace ("/bil/data" , "https://brainimagelibrary.org" , 1 ) #replace (/bil/data) from the json_file
15
- print ( jsonFile ) #ERROR 404
11
+ isNotZero = df [df ["score" ] != 0.0 ] #only have files with the correct data
12
+ randomRow = isNotZero .iloc [random .randint (0 , len (isNotZero ))] #select a random row of random index
13
+ jsonFileLink = randomRow .json_file .replace ("/bil/data" , "https://download. brainimagelibrary.org" , 1 ) #create the link
14
+ result = requests . get ( jsonFileLink )
16
15
16
+ return result .json ()
17
+
17
18
def today ():
18
19
"""
19
20
Get today's snapshot of Brain Image Library.
You can’t perform that action at this time.
0 commit comments