Reputation:
This .json file contains record from ECG machine. The file format looks like this:
[-0.140625,-0.15234375,-0.15234375,...,-0.19335937499999997,0 ]
However, when I try to use this code, it shows an error
def load_tester(path):
dataset = '{"fruits": }'
data = json.loads(path)
print(data)
return(np.asarray(nt))
this is the error:
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I want to save that file into numpy array and become as same as the format that the json uses.
Upvotes: 1
Views: 15516
Reputation: 5488
You are trying to load json usign a file name, but not data that is in the file
def load_tester(path):
with open(path) as f:
data = json.load(f)
print(data)
return np.asarray(data)
Upvotes: 11