Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
else:
xerr_object = None
if yerr[i] is not None:
yerr_values = self.df.evaluate(yerr[i], selection=selection_value)
yerr_object = go.scatter.ErrorY(array=yerr_values, thickness=0.5)
else:
yerr_object = None
if size[i] is not None:
if isinstance(size[i], vaex.expression.Expression):
size_values = self.df.evaluate(size[i], selection=selection_value)
else:
size_values = size[i]
else:
size_values = size[i]
if color[i] is not None:
if isinstance(color[i], vaex.expression.Expression):
color_values = self.df.evaluate(color[i], selection=selection_value)
cbar = go.scatter.marker.ColorBar(title=colorbar_label)
else:
cbar = None
color_values = color[i]
else:
cbar = None
color_values = color[i]
# This builds the data needed for the tooltip display, including the template
hovertemplate = ''
if tooltip_title[i] is not None:
hover_title = self.df.evaluate(tooltip_title[i])
hovertemplate += '<b>%{hovertext}</b><br>'
else:
hover_title = None
def filter(self, df):
expression = vaex.expression.Expression(df, '(1==1)')
if self._and:
for value in self._and:
expression = expression & value.filter(df)
if self._or:
or_expression = self._or[0].filter(df)
for value in self._or[1:]:
or_expression = or_expression | value.filter(df)
expression = expression & or_expression
if self._not:
expression = expression & ~self._not.filter(df)
for name in column_names:
value = getattr(self, name)
if value is not None:
expression = expression & value.filter(df, name)
return expression
def _rename_expression_string(df, e, old, new):
return vaex.expression.Expression(self.df, self.boolean_expression)._rename(old, new).expression
def _load_table(self, table):
self._length_unfiltered = self._length_original = table.num_rows
self._index_end = self._length_original = table.num_rows
for col, name in zip(table.columns, table.schema.names):
# TODO: keep the arrow columns, and support and test chunks
arrow_array = col.chunk(0)
if isinstance(arrow_array.type, pa.DictionaryType):
column = column_from_arrow_array(arrow_array.indices)
labels = column_from_arrow_array(arrow_array.dictionary).tolist()
self._categories[name] = dict(labels=labels, N=len(labels))
else:
column = column_from_arrow_array(arrow_array)
self.columns[name] = column
self.column_names.append(name)
self._save_assign_expression(name, vaex.expression.Expression(self, name))
def _rename(self, df, old, new):
boolean_expression = vaex.expression.Expression(df, self.boolean_expression)._rename(old, new).expression
previous_selection = None
if self.previous_selection:
previous_selection = self.previous_selection._rename(df, old, new)
return SelectionExpression(boolean_expression, previous_selection, self.mode)
def evaluate(self, expression, out=None):
if isinstance(expression, vaex.expression.Expression):
expression = expression.expression
try:
# logger.debug("try avoid evaluating: %s", expression)
result = self[expression]
except KeyError:
# logger.debug("no luck, eval: %s", expression)
# result = ne.evaluate(expression, local_dict=self, out=out)
# logger.debug("in eval")
# eval("def f(")
result = eval(expression, expression_namespace, self)
self.values[expression] = result
# if out is not None:
# out[:] = result
# result = out
# logger.debug("out eval")
# logger.debug("done with eval of %s", expression)
selection_value = selection[i]
x_values = self.df.evaluate(x[i], selection=selection_value)
y_values = self.df.evaluate(y[i], selection=selection_value)
if xerr[i] is not None:
xerr_values = self.df.evaluate(xerr[i], selection=selection_value)
xerr_object = go.scatter.ErrorX(array=xerr_values, thickness=0.5)
else:
xerr_object = None
if yerr[i] is not None:
yerr_values = self.df.evaluate(yerr[i], selection=selection_value)
yerr_object = go.scatter.ErrorY(array=yerr_values, thickness=0.5)
else:
yerr_object = None
if size[i] is not None:
if isinstance(size[i], vaex.expression.Expression):
size_values = self.df.evaluate(size[i], selection=selection_value)
else:
size_values = size[i]
else:
size_values = size[i]
if color[i] is not None:
if isinstance(color[i], vaex.expression.Expression):
color_values = self.df.evaluate(color[i], selection=selection_value)
cbar = go.scatter.marker.ColorBar(title=colorbar_label)
else:
cbar = None
color_values = color[i]
else:
cbar = None
color_values = color[i]