Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"All-column" vis when only few columns in dataframe #199 #336

Merged
merged 45 commits into from
Apr 18, 2021
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
74da4f4
rec series
Feb 16, 2021
8548ab2
rec
Feb 16, 2021
ea2280e
added des
Feb 17, 2021
c715125
add changes back
Feb 17, 2021
68aadb3
fix tests
Feb 17, 2021
f3ee32d
rm
Feb 17, 2021
00a7165
change
Feb 17, 2021
5192fb5
set plotting_style
Feb 17, 2021
4cc0750
Merge branch 'master' of https://github.com/lux-org/lux
Feb 18, 2021
5f431ef
lux series export
Feb 19, 2021
3d529e0
nice
Feb 19, 2021
9a92247
black
Feb 19, 2021
9b6ccc0
rm
Feb 19, 2021
f5c9efd
change rec
Feb 19, 2021
7a379bb
Merge branch 'master' of https://github.com/lux-org/lux
Feb 21, 2021
4aa47d7
Merge branch 'master' of https://github.com/lux-org/lux
Feb 24, 2021
ec40700
reuse export
Feb 24, 2021
ed22f8a
remove altair
Mar 26, 2021
e6a0ee8
nice
Mar 26, 2021
e6b069c
rm
Mar 26, 2021
a03c081
fix
Mar 26, 2021
b5ccd58
fix merge
Mar 29, 2021
70cf633
rm
Mar 29, 2021
cf85700
black
Mar 29, 2021
ede0e0d
Merge branch 'master' of https://github.com/lux-org/lux into matplotl…
Mar 29, 2021
326828a
Merge branch 'master' of https://github.com/lux-org/lux into matplotl…
Mar 31, 2021
f063bf8
all column vis
Mar 31, 2021
e32f8ae
only quant
Mar 31, 2021
9e15b2c
rip
Mar 31, 2021
36ef3ad
add tests
Mar 31, 2021
369113e
black
Mar 31, 2021
edaad3f
tests
Apr 7, 2021
bfba8b7
rm
Apr 7, 2021
6459bc3
Merge branch 'master' of https://github.com/lux-org/lux into allcol
Apr 7, 2021
40b1681
fix
Apr 12, 2021
d15cef2
fix
Apr 12, 2021
16a323b
del
Apr 12, 2021
3920ba5
black
Apr 13, 2021
524a252
add tests
Apr 13, 2021
d9253a3
tests updated
Apr 13, 2021
66b0f44
black
Apr 13, 2021
82037ff
edit
Apr 13, 2021
b816268
Merge branch 'allcol' of https://github.com/caitlynachen/lux into cai…
dorisjlee Apr 17, 2021
7a44890
rewrote show all column vis logic and frontend integration to avoid t…
dorisjlee Apr 17, 2021
1b7cf75
minor fix
dorisjlee Apr 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lux/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,15 @@ 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"]
caitlynachen marked this conversation as resolved.
Show resolved Hide resolved
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"]
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()
caitlynachen marked this conversation as resolved.
Show resolved Hide resolved
self._recs_fresh = True

Expand Down
129 changes: 129 additions & 0 deletions tests/test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,132 @@ def test_intent_retained():

df._ipython_display_()
assert list(df.recommendation.keys()) == ["Enhance", "Filter"]


def test_all_column_current_vis():
df = pd.read_csv(
"https://raw.githubusercontent.com/koldunovn/python_for_geosciences/master/DelhiTmax.txt",
delimiter=r"\s+",
parse_dates=[[0, 1, 2]],
header=None,
)
df.columns = ["Date", "Temp"]
df._ipython_display_()
assert df.current_vis != None

df = pd.DataFrame(
{
"nPts": {
0: 49999,
1: 71174,
2: 101317,
3: 144224,
4: 205303,
5: 292249,
6: 416016,
7: 592198,
8: 842993,
9: 1200000,
},
"t_heatmap": {
0: 0.15121674537658691,
1: 0.1811518669128418,
2: 0.2179429531097412,
3: 0.2787730693817139,
4: 0.3973350524902344,
5: 0.4233138561248779,
6: 0.580251932144165,
7: 0.7928099632263184,
8: 1.0876789093017578,
9: 1.6242818832397459,
},
"t_color_heatmap": {
0: 0.14242982864379886,
1: 0.18866705894470212,
2: 0.1566781997680664,
3: 0.16737699508666992,
4: 0.19900894165039065,
5: 0.2701129913330078,
6: 0.2533812522888184,
7: 0.37183785438537603,
8: 0.3830866813659668,
9: 0.39321017265319824,
},
"t_bar": {
0: 0.01940608024597168,
1: 0.02618718147277832,
2: 0.024693727493286133,
3: 0.029685020446777344,
4: 0.03471803665161133,
5: 0.04173588752746582,
6: 0.04706382751464844,
7: 0.0667569637298584,
8: 0.08260798454284668,
9: 0.1006929874420166,
},
"t_cbar": {
0: 0.04185795783996582,
1: 0.050965070724487305,
2: 0.052091121673583984,
3: 0.0610501766204834,
4: 0.07504606246948242,
5: 0.09924101829528807,
6: 0.10392117500305176,
7: 0.13044309616088867,
8: 0.18137121200561526,
9: 0.2069528102874756,
},
"t_hist": {
0: 0.01846003532409668,
1: 0.018136978149414062,
2: 0.018748998641967773,
3: 0.01876473426818848,
4: 0.02434706687927246,
5: 0.025368213653564453,
6: 0.02530217170715332,
7: 0.02823114395141602,
8: 0.029034852981567383,
9: 0.034781217575073235,
},
"t_scatter": {
0: 0.8179378509521484,
1: 1.0982017517089844,
2: 1.4875690937042236,
3: 2.146117925643921,
4: 3.1123709678649902,
5: 3.92416787147522,
6: 6.097048044204713,
7: 8.803220987319945,
8: 12.054464101791382,
9: 17.740845680236816,
},
"t_color_scatter": {
0: 1.3474130630493164,
1: 1.7953579425811768,
2: 2.6268541812896733,
3: 3.646371126174927,
4: 4.901940107345581,
5: 6.974237203598023,
6: 10.197483777999876,
7: 14.134275913238525,
8: 21.13951110839844,
9: 27.127063989639282,
},
}
)
df = df.melt(
id_vars=["nPts"],
value_vars=[
"t_heatmap",
"t_color_heatmap",
"t_bar",
"t_cbar",
"t_hist",
"t_scatter",
"t_color_scatter",
],
var_name="type",
value_name="t",
)
df._ipython_display_()
assert df.current_vis != None