diff --git a/searvey/coops.py b/searvey/coops.py index f345a0a..94fd107 100644 --- a/searvey/coops.py +++ b/searvey/coops.py @@ -597,12 +597,15 @@ def data(self) -> DataFrame: response = requests.get(self.URL, params=self.query) data = response.json() fields = ["t", "v", "s", "f", "q"] - if "error" in data or "data" not in data: + if "error" in data or not ("data" in data or "predictions" in data): if "error" in data: self.__error = data["error"]["message"] data = DataFrame(columns=fields) else: - data = DataFrame(data["data"], columns=fields) + key = "data" + if "predictions" in data: + key = "predictions" + data = DataFrame(data[key], columns=fields) data[data == ""] = numpy.nan data = data.astype( {"v": numpy.float32, "s": numpy.float32, "f": "string", "q": "string"},