Skip to content

Commit

Permalink
fix form
Browse files Browse the repository at this point in the history
  • Loading branch information
Caitlyn Chen committed Mar 31, 2021
1 parent e32f8ae commit 89c206d
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lux/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,7 @@ def get_SQL_cardinality(self):
cardinality = {}
for attr in list(self.columns):
card_query = pd.read_sql(
f"SELECT Count(Distinct({attr})) FROM {self.table_name}",
lux.config.SQLconnection,
f"SELECT Count(Distinct({attr})) FROM {self.table_name}", lux.config.SQLconnection,
)
cardinality[attr] = list(card_query["count"])[0]
self.cardinality = cardinality
Expand All @@ -373,8 +372,7 @@ def get_SQL_unique_values(self):
unique_vals = {}
for attr in list(self.columns):
unique_query = pd.read_sql(
f"SELECT Distinct({attr}) FROM {self.table_name}",
lux.config.SQLconnection,
f"SELECT Distinct({attr}) FROM {self.table_name}", lux.config.SQLconnection,
)
unique_vals[attr] = list(unique_query[attr])
self.unique_values = unique_vals
Expand Down Expand Up @@ -498,13 +496,13 @@ def maintain_recs(self, is_series="DataFrame"):
if len(vlist) > 0:
rec_df._recommendation[action_type] = vlist
rec_df._rec_info = rec_infolist
quantitative_columns = [i for i in self.dtypes if i != 'O' and i != 'str']
quantitative_columns = [i for i in self.dtypes if i != "O" and i != "str"]
if len(quantitative_columns) == 2 or len(quantitative_columns) == 3:
self.current_vis = VisList([i for i in self.columns], self)
self._widget = rec_df.render_widget()
# re-render widget for the current dataframe if previous rec is not recomputed
elif show_prev:
quantitative_columns = [i for i in self.dtypes if i != 'O' and i != 'str']
quantitative_columns = [i for i in self.dtypes if i != "O" and i != "str"]
if len(quantitative_columns) == 2 or len(quantitative_columns) == 3:
self.current_vis = VisList([i for i in self.columns], self)
self._widget = rec_df.render_widget()
Expand Down Expand Up @@ -580,8 +578,7 @@ def exported(self) -> Union[Dict[str, VisList], VisList]:
exported_vis = VisList(
list(
map(
self._recommendation[export_action].__getitem__,
exported_vis_lst[export_action],
self._recommendation[export_action].__getitem__, exported_vis_lst[export_action],
)
)
)
Expand Down Expand Up @@ -652,8 +649,7 @@ def _ipython_display_(self):
self._widget.observe(self.set_intent_on_click, names="selectedIntentIndex")

button = widgets.Button(
description="Toggle Pandas/Lux",
layout=widgets.Layout(width="140px", top="5px"),
description="Toggle Pandas/Lux", layout=widgets.Layout(width="140px", top="5px"),
)
self.output = widgets.Output()
display(button, self.output)
Expand Down

0 comments on commit 89c206d

Please sign in to comment.