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

Add code to display inside Google Colab #220

Merged
merged 1 commit into from
Jul 8, 2020
Merged

Conversation

korakot
Copy link
Contributor

@korakot korakot commented Jul 7, 2020

Description

This fixes issue #102 to display plot in Colab correctly.

How Has This Been Tested?

I test this will a minimal example plot(df) where df is sns.load_dataset('titanic')

In colab you need to install dataprep first with !pip install -U tornado dataprep then restart the runtime.

Snapshots:

Include snapshots for easier review.

Checklist:

  • My code follows the style guidelines of this project
  • I have already squashed the commits and make the commit message conform to the project standard.
  • I have already marked the commit with "BREAKING CHANGE" or "Fixes #" if needed.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@dovahcrow
Copy link
Member

@korakot Thanks for your PR! May I ask if it is safe to load bokeh scripts multiple times in parallel?

It seems to me load_notebook(hide_banner=True) will add script tags to the cell output to load the bokeh library. If I have multiple cells output the plots, when reopening the Colab notebook, multiple bokeh scripts will be loaded simultaneously.

@korakot
Copy link
Contributor Author

korakot commented Jul 8, 2020

For Colab, each cell is an IFrame. So, each need to load bokeh separately. That's why it needs to be called here in Report._repr_html_(). Yes, it should be safe.

dovahcrow
dovahcrow previously approved these changes Jul 8, 2020
Copy link
Member

@dovahcrow dovahcrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thanks for your contribution!

Each cell in Colab is in a different IFrame so we need to load bokeh in each cell.
@codecov
Copy link

codecov bot commented Jul 8, 2020

Codecov Report

Merging #220 into develop will decrease coverage by 0.04%.
The diff coverage is 57.14%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #220      +/-   ##
===========================================
- Coverage    75.58%   75.53%   -0.05%     
===========================================
  Files           28       28              
  Lines         2822     2829       +7     
===========================================
+ Hits          2133     2137       +4     
- Misses         689      692       +3     
Impacted Files Coverage Δ
dataprep/eda/report.py 87.50% <57.14%> (-8.50%) ⬇️

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 fc39836...e61d16c. Read the comment docs.

@dovahcrow dovahcrow merged commit 1917edc into sfu-db:develop Jul 8, 2020
devinllu pushed a commit to devinllu/dataprep that referenced this pull request Nov 9, 2021
Add code to display inside Google Colab
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.

None yet

2 participants