Skip to content

Commit

Permalink
Commit for release 2.1.1.
Browse files Browse the repository at this point in the history
- Fix of [#206]
- Improve code maintainability of the view (HTML templates, notebook)
- Fix bug in dendrogram sizing
  • Loading branch information
sbrugman committed Jul 10, 2019
1 parent 7006709 commit a7ff4ab
Show file tree
Hide file tree
Showing 27 changed files with 448 additions and 434 deletions.
4 changes: 2 additions & 2 deletions docs/controller/console.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ <h1 class="title">Module <code>pandas_profiling.controller.console</code></h1>
if not args.silent:
import webbrowser

webbrowser.open_new_tab(p.file.name)</code></pre>
webbrowser.open_new_tab(args.output_file)</code></pre>
</details>
</section>
<section>
Expand Down Expand Up @@ -144,7 +144,7 @@ <h2 id="args">Args</h2>
if not args.silent:
import webbrowser

webbrowser.open_new_tab(p.file.name)</code></pre>
webbrowser.open_new_tab(args.output_file)</code></pre>
</details>
</dd>
<dt id="pandas_profiling.controller.console.parse_args"><code class="name flex">
Expand Down
84 changes: 5 additions & 79 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ <h2 id="dependencies">Dependencies</h2>

.. include:: ../README.md
&#34;&#34;&#34;
import html
import sys
import warnings

Expand All @@ -174,6 +173,7 @@ <h2 id="dependencies">Dependencies</h2>
from pandas_profiling.controller import pandas_decorator
import pandas_profiling.view.templates as templates
from pandas_profiling.model.describe import describe as describe_df
from pandas_profiling.view.notebook import display_notebook_iframe
from pandas_profiling.view.report import to_html


Expand Down Expand Up @@ -319,50 +319,13 @@ <h2 id="dependencies">Dependencies</h2>
&#34;&#34;&#34;Used to output the HTML representation to a Jupyter notebook.
When config.notebook.iframe.attribute is &#34;src&#34;, this function creates a temporary HTML file
in `./tmp/profile_[hash].html` and returns an Iframe pointing to that contents.
When config.notebook.iframe.attribute is &#34;srco&#34;, the same HTML is injected in the &#34;srcdoc&#34; attribute of
When config.notebook.iframe.attribute is &#34;srcdoc&#34;, the same HTML is injected in the &#34;srcdoc&#34; attribute of
the Iframe.

Notes:
This constructions solves problems with conflicting stylesheets and navigation links.
&#34;&#34;&#34;
attribute = config[&#34;notebook&#34;][&#34;iframe&#34;][&#34;attribute&#34;].get(str)
if attribute == &#34;src&#34;:
tmp_file = Path(&#34;./ipynb_tmp&#34;) / self.get_unique_file_name()
tmp_file.parent.mkdir(exist_ok=True)
self.to_file(tmp_file)
from IPython.lib.display import IFrame, display

display(
IFrame(
str(tmp_file),
width=config[&#34;notebook&#34;][&#34;iframe&#34;][&#34;width&#34;].get(str),
height=config[&#34;notebook&#34;][&#34;iframe&#34;][&#34;height&#34;].get(str),
)
)
elif attribute:
from IPython.core.display import HTML, display

iframe = &#34;&#34;&#34;
&lt;iframe
width=&#34;{width}&#34;
height=&#34;{height}&#34;
srcdoc=&#34;{src}&#34;
frameborder=&#34;0&#34;
allowfullscreen
&gt;&lt;/iframe&gt;
&#34;&#34;&#34;
iframe = iframe.format(
width=config[&#34;notebook&#34;][&#34;iframe&#34;][&#34;width&#34;].get(str),
height=config[&#34;notebook&#34;][&#34;iframe&#34;][&#34;height&#34;].get(str),
src=html.escape(self.to_html()),
)
display(HTML(iframe))
else:
raise ValueError(
&#39;Iframe Attribute can be &#34;src&#34; or &#34;srcdoc&#34; (current: {}).&#39;.format(
attribute
)
)
display_notebook_iframe(self)

def __repr__(self):
&#34;&#34;&#34;Override so that Jupyter Notebook does not print the object.&#34;&#34;&#34;
Expand Down Expand Up @@ -556,50 +519,13 @@ <h2 class="section-title" id="header-classes">Classes</h2>
&#34;&#34;&#34;Used to output the HTML representation to a Jupyter notebook.
When config.notebook.iframe.attribute is &#34;src&#34;, this function creates a temporary HTML file
in `./tmp/profile_[hash].html` and returns an Iframe pointing to that contents.
When config.notebook.iframe.attribute is &#34;srco&#34;, the same HTML is injected in the &#34;srcdoc&#34; attribute of
When config.notebook.iframe.attribute is &#34;srcdoc&#34;, the same HTML is injected in the &#34;srcdoc&#34; attribute of
the Iframe.

Notes:
This constructions solves problems with conflicting stylesheets and navigation links.
&#34;&#34;&#34;
attribute = config[&#34;notebook&#34;][&#34;iframe&#34;][&#34;attribute&#34;].get(str)
if attribute == &#34;src&#34;:
tmp_file = Path(&#34;./ipynb_tmp&#34;) / self.get_unique_file_name()
tmp_file.parent.mkdir(exist_ok=True)
self.to_file(tmp_file)
from IPython.lib.display import IFrame, display

display(
IFrame(
str(tmp_file),
width=config[&#34;notebook&#34;][&#34;iframe&#34;][&#34;width&#34;].get(str),
height=config[&#34;notebook&#34;][&#34;iframe&#34;][&#34;height&#34;].get(str),
)
)
elif attribute:
from IPython.core.display import HTML, display

iframe = &#34;&#34;&#34;
&lt;iframe
width=&#34;{width}&#34;
height=&#34;{height}&#34;
srcdoc=&#34;{src}&#34;
frameborder=&#34;0&#34;
allowfullscreen
&gt;&lt;/iframe&gt;
&#34;&#34;&#34;
iframe = iframe.format(
width=config[&#34;notebook&#34;][&#34;iframe&#34;][&#34;width&#34;].get(str),
height=config[&#34;notebook&#34;][&#34;iframe&#34;][&#34;height&#34;].get(str),
src=html.escape(self.to_html()),
)
display(HTML(iframe))
else:
raise ValueError(
&#39;Iframe Attribute can be &#34;src&#34; or &#34;srcdoc&#34; (current: {}).&#39;.format(
attribute
)
)
display_notebook_iframe(self)

def __repr__(self):
&#34;&#34;&#34;Override so that Jupyter Notebook does not print the object.&#34;&#34;&#34;
Expand Down
34 changes: 24 additions & 10 deletions docs/model/describe.html
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,14 @@ <h1 class="title">Module <code>pandas_profiling.model.describe</code></h1>
A dictionary containing the base64 encoded plots for each diagram that is active in the config (matrix, bar, heatmap, dendrogram).
&#34;&#34;&#34;
missing_map = {
&#34;matrix&#34;: {&#34;func&#34;: plot.missing_matrix, &#34;min_missing&#34;: 0},
&#34;bar&#34;: {&#34;func&#34;: plot.missing_bar, &#34;min_missing&#34;: 0},
&#34;heatmap&#34;: {&#34;func&#34;: plot.missing_heatmap, &#34;min_missing&#34;: 2},
&#34;dendrogram&#34;: {&#34;func&#34;: plot.missing_dendrogram, &#34;min_missing&#34;: 1},
&#34;bar&#34;: {&#34;func&#34;: plot.missing_bar, &#34;min_missing&#34;: 0, &#34;name&#34;: &#34;Count&#34;},
&#34;matrix&#34;: {&#34;func&#34;: plot.missing_matrix, &#34;min_missing&#34;: 0, &#34;name&#34;: &#34;Matrix&#34;},
&#34;heatmap&#34;: {&#34;func&#34;: plot.missing_heatmap, &#34;min_missing&#34;: 2, &#34;name&#34;: &#34;Heatmap&#34;},
&#34;dendrogram&#34;: {
&#34;func&#34;: plot.missing_dendrogram,
&#34;min_missing&#34;: 1,
&#34;name&#34;: &#34;Dendrogram&#34;,
},
}

missing = {}
Expand All @@ -430,7 +434,10 @@ <h1 class="title">Module <code>pandas_profiling.model.describe</code></h1>
table_stats[&#34;n_vars_with_missing&#34;] - table_stats[&#34;n_vars_all_missing&#34;]
&gt;= settings[&#34;min_missing&#34;]
):
missing[name] = settings[&#34;func&#34;](df)
missing[name] = {
&#34;name&#34;: settings[&#34;name&#34;],
&#34;matrix&#34;: settings[&#34;func&#34;](df),
}
return missing


Expand Down Expand Up @@ -1241,10 +1248,14 @@ <h2 id="returns">Returns</h2>
A dictionary containing the base64 encoded plots for each diagram that is active in the config (matrix, bar, heatmap, dendrogram).
&#34;&#34;&#34;
missing_map = {
&#34;matrix&#34;: {&#34;func&#34;: plot.missing_matrix, &#34;min_missing&#34;: 0},
&#34;bar&#34;: {&#34;func&#34;: plot.missing_bar, &#34;min_missing&#34;: 0},
&#34;heatmap&#34;: {&#34;func&#34;: plot.missing_heatmap, &#34;min_missing&#34;: 2},
&#34;dendrogram&#34;: {&#34;func&#34;: plot.missing_dendrogram, &#34;min_missing&#34;: 1},
&#34;bar&#34;: {&#34;func&#34;: plot.missing_bar, &#34;min_missing&#34;: 0, &#34;name&#34;: &#34;Count&#34;},
&#34;matrix&#34;: {&#34;func&#34;: plot.missing_matrix, &#34;min_missing&#34;: 0, &#34;name&#34;: &#34;Matrix&#34;},
&#34;heatmap&#34;: {&#34;func&#34;: plot.missing_heatmap, &#34;min_missing&#34;: 2, &#34;name&#34;: &#34;Heatmap&#34;},
&#34;dendrogram&#34;: {
&#34;func&#34;: plot.missing_dendrogram,
&#34;min_missing&#34;: 1,
&#34;name&#34;: &#34;Dendrogram&#34;,
},
}

missing = {}
Expand All @@ -1257,7 +1268,10 @@ <h2 id="returns">Returns</h2>
table_stats[&#34;n_vars_with_missing&#34;] - table_stats[&#34;n_vars_all_missing&#34;]
&gt;= settings[&#34;min_missing&#34;]
):
missing[name] = settings[&#34;func&#34;](df)
missing[name] = {
&#34;name&#34;: settings[&#34;name&#34;],
&#34;matrix&#34;: settings[&#34;func&#34;](df),
}
return missing</code></pre>
</details>
</dd>
Expand Down
5 changes: 5 additions & 0 deletions docs/utils/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ <h2 class="section-title" id="header-submodules">Sub-modules</h2>
<dd>
<section class="desc"><p>Utils for pandas DataFrames.</p></section>
</dd>
<dt><code class="name"><a title="pandas_profiling.utils.notebook" href="notebook.html">pandas_profiling.utils.notebook</a></code></dt>
<dd>
<section class="desc"><p>Utility functions that come in handy when working with Jupyter notebooks</p></section>
</dd>
<dt><code class="name"><a title="pandas_profiling.utils.paths" href="paths.html">pandas_profiling.utils.paths</a></code></dt>
<dd>
<section class="desc"><p>Paths that are useful throughout the project.</p></section>
Expand Down Expand Up @@ -65,6 +69,7 @@ <h1>Index</h1>
<ul>
<li><code><a title="pandas_profiling.utils.common" href="common.html">pandas_profiling.utils.common</a></code></li>
<li><code><a title="pandas_profiling.utils.dataframe" href="dataframe.html">pandas_profiling.utils.dataframe</a></code></li>
<li><code><a title="pandas_profiling.utils.notebook" href="notebook.html">pandas_profiling.utils.notebook</a></code></li>
<li><code><a title="pandas_profiling.utils.paths" href="paths.html">pandas_profiling.utils.paths</a></code></li>
</ul>
</li>
Expand Down
5 changes: 5 additions & 0 deletions docs/view/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ <h2 class="section-title" id="header-submodules">Sub-modules</h2>
<dd>
<section class="desc"><p>Formatters are utilities for formatting numbers and certain strings</p></section>
</dd>
<dt><code class="name"><a title="pandas_profiling.view.notebook" href="notebook.html">pandas_profiling.view.notebook</a></code></dt>
<dd>
<section class="desc"><p>Functionality related to displaying the profile report in Jupyter notebooks.</p></section>
</dd>
<dt><code class="name"><a title="pandas_profiling.view.plot" href="plot.html">pandas_profiling.view.plot</a></code></dt>
<dd>
<section class="desc"><p>Plot functions for the profiling report.</p></section>
Expand Down Expand Up @@ -68,6 +72,7 @@ <h1>Index</h1>
<li><h3><a href="#header-submodules">Sub-modules</a></h3>
<ul>
<li><code><a title="pandas_profiling.view.formatters" href="formatters.html">pandas_profiling.view.formatters</a></code></li>
<li><code><a title="pandas_profiling.view.notebook" href="notebook.html">pandas_profiling.view.notebook</a></code></li>
<li><code><a title="pandas_profiling.view.plot" href="plot.html">pandas_profiling.view.plot</a></code></li>
<li><code><a title="pandas_profiling.view.report" href="report.html">pandas_profiling.view.report</a></code></li>
<li><code><a title="pandas_profiling.view.templates" href="templates.html">pandas_profiling.view.templates</a></code></li>
Expand Down
4 changes: 2 additions & 2 deletions docs/view/plot.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ <h1 class="title">Module <code>pandas_profiling.view.plot</code></h1>
height = 4
if len(data.columns) &gt; 10:
height += int((len(data.columns) - 10) / 5)
height = max(height, 10)
height = min(height, 10)

missingno.heatmap(
data,
Expand Down Expand Up @@ -543,7 +543,7 @@ <h2 id="returns">Returns</h2>
height = 4
if len(data.columns) &gt; 10:
height += int((len(data.columns) - 10) / 5)
height = max(height, 10)
height = min(height, 10)

missingno.heatmap(
data,
Expand Down
Loading

0 comments on commit a7ff4ab

Please sign in to comment.