Skip to main content

show_in_browser

A simple python package to display pandas dataframes and matplotlib/plotly graphs in a browser. This package is intended to be used from the command line, for better visualisation of dataframes than viewing within the terminal. (E.g. to allow viewing of the entire dataframe, scrolling etc). In addition, plots appear sequentially as separate browser tabs, so they can be viewed in a deliberate sequence.

To install use: pip install show-in-browser

The following code shows some example uses (in an ipython session):

# import the show_in_browser functions as on the line below:
# (alternatively you can use `import show_in_browser as sib` and then access the functions
# with `sib.show_df()` etc.)
from show_in_browser import show_df, show_plt_plot, show_px_plot 

# other imports for the demo script
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import plotly.express as px

# ==============================================================================
# SHOW DATAFRAMES IN THE BROWSER
# this section shows how to use the `show_df()` function to display a dataframe
# in the browser

# create dataframe
df = pd.DataFrame({'score_1': np.random.normal(100, 10, 100),
                'score_2': np.random.normal(1000, 2, 100),
                'score_3': np.random.normal(10, 2, 100)})

# show a DataFrame in a browser
show_df(df, name='Complete DataFrame') # name is optional

# show a Series derived from the DataFrame in a browser
show_df(df['score_1'], name='A Single Column') # name is optional

# ==============================================================================
# SHOW MATPLOTLIB PLOTS IN THE BROWSER
# this section shows how to use the `show_plt_plot()` function to display a
# matplotlib plots in the browser

# 2D matplotlib plot
plt.figure()
plt.scatter(df['score_1'], df['score_2'])
show_plt_plot(name='Matplotlib Scatterplot') # name is optional

# 3D matplotlib plot
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(df['score_1'], df['score_2'], df['score_3'])
show_plt_plot(name='Matplotlib 3D Scatterplot') # name is optional

# ==============================================================================
# SHOW PLOTLY PLOTS IN THE BROWSER
# this section shows how to use the `show_px_plot()` function to display a
# matplotlib plots in the browser

# 2D plotly plot
fig = px.scatter(df, x='score_1', y='score_2')
show_px_plot(fig, name='Plotly Scatterplot') # name is optional

# 3D plotly plot
fig = px.scatter_3d(df, x='score_1', y='score_2', z='score_3')
show_px_plot(fig, name='Plotly 3D Scatterplot') # name is optional

This code will give you output of the following form, in your default browser. Each dataframe or plot that you have selected will show in separate tabs in your default browser. The dataframes and plots will appear in the order in which you ran the commands:

Metadata

Release files for show-in-browser 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for show-in-browser 0.1.6
File Size Uploaded
show_in_browser-0.1.6.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for show-in-browser 0.1.6
File Interpreter ABI Platform
show_in_browser-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / show_in_browser-0.1.6.tar.gz

Download URL show_in_browser-0.1.6.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8cfb25233d97401a046e05487f4ed765ba953d69610704bdf8b8beef95d76eed
BLAKE2b-256 checksum
How to use checksums
3e3f7ea5ebcf311d6afce5d1a184bdf1835abecce92a1dc5d27e5ad8d756d684
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / show_in_browser-0.1.6-py3-none-any.whl

Download URL show_in_browser-0.1.6-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2dab9a15b04bc8390da5dfb29a2beef0a666c105a2573533d417dc0c70f39364
BLAKE2b-256 checksum
How to use checksums
64b545e433bab5386dce422414e0eb9c0eb17810050b15d01a4b8322415c6fe9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page