Commit 43991106 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Add protection to deal with empty data set.

parent f1b502c0
......@@ -246,9 +246,11 @@ class List(BaseReport):
dataIndex = [''.join(el) for el in self._maps]
data = self._do_data()
df = pd.DataFrame(data, columns=dataIndex)
if not data:
self.df = pd.DataFrame(columns=dataIndex)
return
self.df = df
self.df = pd.DataFrame(data, columns=dataIndex)
def _encode(self, value):
......@@ -501,6 +503,10 @@ class Metric1D(BaseReport):
# interrogate the database and fill the data frame
data = self._do_data(cfg)
if not data:
self.df = pd.DataFrame(columns=labels)
return
df = pd.DataFrame(data, columns=labels)
# aggregate the data running dedicated operator for each column
......@@ -701,6 +707,10 @@ class Metric2D(BaseReport):
# build the data frame
data = self._do_data(map_x, map_y, map_z)
if not data:
self.df = pd.DataFrame(columns=[address_x, address_y, address_z])
return
df = pd.DataFrame(data, columns=[address_x, address_y, address_z])
# remove duplicate entries
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment