Skip to main content

pandas-highcharts is a Python package which allows you to easily build Highcharts plots with pandas.DataFrame objects.

Project description

https://travis-ci.org/gtnx/pandas-highcharts.svg?branch=master

What is it

pandas-highcharts is a Python package which allows you to easily build Highcharts plots with pandas.DataFrame objects.

Motivation

  • pandas is the best tool to handle data in Python

  • pandas is able to produce matplotlib plots. They work pretty well but have two major drawbacks

    • Not very web friendly

    • Pretty ugly

  • Highcharts produce nice, interactive plot in your browser and is very complete

Features

  • Same interface as DataFrame.plot

  • Following parameters are handled

    • data

    • x

    • y

    • kind

    • figsize

    • use_index

    • title

    • grid

    • legend

    • style

    • logx

    • logy

    • loglog

    • xticks

    • yticks

    • xlim

    • ylim

    • rot

    • fontsize

    • position

    • stacked

    • sort_columns

    • secondary_y

    • mark_right

  • Following parameters are not handled (yet) :

    • ax

    • ay

    • subplots

    • sharex

    • sharey

    • layout

    • colormap

    • colorbar

    • layout

    • table

    • yerr

    • xerr

    • kwds

  • Static files (highcharts.js) are not embedded

Installation

Install the package using pip

pip install pandas-highcharts

Usage

Import it in your views

import pandas_highcharts
df = ... # create your dataframe here
chart = pandas_highcharts.serialize(df, render_to = "my-chart")

In your templates

<div id="my-chart"></div>
<script type="text/javascript">{{chart|safe}}</script>

More examples

Some examples are available on nbviewer.

Please read the doc for DataFrame.plot.

For example, with the following dataset:

                             A          B     C
ts
2015-01-01 00:00:00   27451873   29956800   113
2015-01-01 01:00:00   20259882   17906600    76
2015-01-01 02:00:00   11592256   12311600    48
2015-01-01 03:00:00   11795562   11750100    50
2015-01-01 04:00:00    9396718   10203900    43
2015-01-01 05:00:00   14902826   14341100    53
# Basic line plot
chart = pandas_highcharts.serialize(df, render_to="my-chart", title="My Chart")
# Basic column plot
chart = pandas_highcharts.serialize(df, render_to="my-chart", title="Test", kind="bar")
# Basic column plot
chart = pandas_highcharts.serialize(df, render_to="my-chart", title="Test", kind="barh")
# Plot C on secondary axis
chart = pandas_highcharts.serialize(df, render_to="my-chart", title="Test", secondary_y = ["C"])
# Plot on a 1000x700 div
chart = pandas_highcharts.serialize(df, render_to="my-chart", title="Test", figsize = (1000, 700))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pandas-highcharts-0.4.1.tar.gz (5.5 kB view details)

Uploaded Source

File details

Details for the file pandas-highcharts-0.4.1.tar.gz.

File metadata

File hashes

Hashes for pandas-highcharts-0.4.1.tar.gz
Algorithm Hash digest
SHA256 65df15ab98ac2d7c2dabe8349a5514633347ef7cbea83d77987f59dca886d841
MD5 e06d3151d080e70b1fdfc256eec70372
BLAKE2b-256 d08c9397269bc2cd14e8a9a13844e6c318d8ffba3fecbd1dfc8b73419521c795

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page