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

Move widget display to Out[...] #308

Merged
merged 5 commits into from
Mar 24, 2021
Merged

Conversation

westernguy2
Copy link
Contributor

Overview

The widget display used to be displayed before Out[...], which is not in accordance to what Pandas usually does. This PR moves the widget to Out[...] in IPython notebooks. This PR addresses both #56 and #60

Changes

I replaced _repr_html_ with _ipython_display_ in both frame.py and vis.py. I then removed __repr__ from frame.py so that it uses the Pandas default __repr__ when the widget isn't displayed. I added a test to ensure this is the case.

Example Output

Below is an example of the widget showing up in Out[...]. Notice that Out[...] doesn't show up below the widget, which means the widget is actually in Out[...]

Screen Shot 2021-03-14 at 5 02 09 PM

@codecov
Copy link

codecov bot commented Mar 15, 2021

Codecov Report

Merging #308 (da6455a) into master (2553125) will decrease coverage by 0.84%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #308      +/-   ##
==========================================
- Coverage   80.87%   80.02%   -0.85%     
==========================================
  Files          50       50              
  Lines        3618     3615       -3     
==========================================
- Hits         2926     2893      -33     
- Misses        692      722      +30     
Impacted Files Coverage Δ
lux/core/frame.py 70.25% <100.00%> (+0.08%) ⬆️
lux/core/series.py 53.84% <100.00%> (-33.78%) ⬇️
lux/vis/Vis.py 74.85% <100.00%> (ø)
lux/vis/VisList.py 51.33% <100.00%> (ø)
lux/vislib/matplotlib/ScatterChart.py 76.47% <0.00%> (+1.17%) ⬆️
lux/vislib/matplotlib/Heatmap.py 98.33% <0.00%> (+1.66%) ⬆️
lux/vislib/altair/ScatterChart.py 96.96% <0.00%> (+3.03%) ⬆️
lux/vislib/altair/Heatmap.py 96.55% <0.00%> (+3.44%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2553125...da6455a. Read the comment docs.

@dorisjlee
Copy link
Member

Hi @westernguy2, The improved output looks much more Pandas-consistent than what we had before! Could we use the
_ipython_display_ approach also for series.py? That way the print(series) behavior would be closer to what print(df) does.

@cjachekang, @westernguy2: Were you able to test this on Jupyter Lab? I tried this on lab but the widget doesn't seem to be displaying. It is possible that there is something wrong with my lab setup.

@dorisjlee dorisjlee merged commit 955a4a1 into lux-org:master Mar 24, 2021
@dorisjlee
Copy link
Member

This looks great, thanks @westernguy2!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants