Giter Club home page Giter Club logo

cufflinks's People

Contributors

aaron-makowski avatar albertw avatar andreicap avatar bingyao avatar chriddyp avatar cooperok avatar eholic avatar gjeusel avatar gnu-user avatar harisbal avatar jamespic avatar jonmmease avatar jorgesantostr avatar kannes avatar ketigid avatar meetnaren avatar mistaka0s avatar nategeorge avatar nicolaskruchten avatar pierian-data avatar plexoos avatar santosjorge avatar shivam6294 avatar thenewflesh avatar timkpaine avatar toddrme2178 avatar tristanboudreault avatar wiggin15 avatar zatnekitel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cufflinks's Issues

Python 3 bug in colors.py

Python 3 upgrades unicode to str and string to bytes. I believe the fix is as follows:

in ~/anaconda/lib/python3.6/site-packages/cufflinks/colors.py

if type(scale) in (bytes,str):
		scale=get_scales(scale)
	else:
		if type(scale)!=list:
			raise Exception("scale needs to be either a scale name or list of colors")
		
	cs=[[1.0*c/(len(scale)-1),scale[c]] for c in range(len(scale))]
	cs.sort()
	return cs  

what do the colors represent in the bubble chart?

import pandas as pd
df = pd.read_csv('http://www.stat.ubc.ca/~jenny/notOcto/STAT545A/examples/gapminder/data/gapminderDataFiveYear.txt', sep='\t')
df2007 = df[df.year==2007]

df2007.iplot(kind='bubble', x='gdpPercap', y='lifeExp', size='pop', text='country', filename='cufflinks/simple-bubble-chart')

I think I expected all of these points to have the same color

kind='scatter3d' or kind='bubble3d' not working when connecting to dataframe

import cufflinks as cf
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
init_notebook_mode(connected=True)
cf.go_offline()

df3 = pd.DataFrame({'x':list(x_pca3[:,0]),
                    'y':list(x_pca3[:,1]),
                    'z':list(x_pca3[:,2])
                  })

df3.iplot(kind='scatter3d')

Error message:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/usr/local/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   2392             try:
-> 2393                 return self._engine.get_loc(key)
   2394             except KeyError:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc (pandas/_libs/index.c:5239)()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc (pandas/_libs/index.c:5085)()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item (pandas/_libs/hashtable.c:20405)()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item (pandas/_libs/hashtable.c:20359)()

KeyError: 12

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
<ipython-input-45-c3f461ea156a> in <module>()
----> 1 df3.iplot(kind='bubble3d')

/usr/local/lib/python3.6/site-packages/cufflinks/plotlytools.py in _iplot(self, data, layout, filename, sharing, kind, title, xTitle, yTitle, zTitle, theme, colors, colorscale, fill, width, dash, mode, symbol, size, barmode, sortbars, bargap, bargroupgap, bins, histnorm, histfunc, orientation, boxpoints, annotations, keys, bestfit, bestfit_colors, mean, mean_colors, categories, x, y, z, text, gridcolor, zerolinecolor, margin, labels, values, secondary_y, secondary_y_title, subplots, shape, error_x, error_y, error_type, locations, lon, lat, asFrame, asDates, asFigure, asImage, dimensions, asPlot, asUrl, online, **kwargs)
    852                                 df['index']=keys
    853                                 if kind=='bubble3d':
--> 854                                         rg=self[size].values
    855                                         size=[int(100*(float(_)-rg.min())/(rg.max()-rg.min()))+12 for _ in rg]
    856                                 else:

/usr/local/lib/python3.6/site-packages/pandas/core/frame.py in __getitem__(self, key)
   2060             return self._getitem_multilevel(key)
   2061         else:
-> 2062             return self._getitem_column(key)
   2063 
   2064     def _getitem_column(self, key):

/usr/local/lib/python3.6/site-packages/pandas/core/frame.py in _getitem_column(self, key)
   2067         # get column
   2068         if self.columns.is_unique:
-> 2069             return self._get_item_cache(key)
   2070 
   2071         # duplicate columns & possible reduce dimensionality

/usr/local/lib/python3.6/site-packages/pandas/core/generic.py in _get_item_cache(self, item)
   1532         res = cache.get(item)
   1533         if res is None:
-> 1534             values = self._data.get(item)
   1535             res = self._box_item_values(item, values)
   1536             cache[item] = res

/usr/local/lib/python3.6/site-packages/pandas/core/internals.py in get(self, item, fastpath)
   3588 
   3589             if not isnull(item):
-> 3590                 loc = self.items.get_loc(item)
   3591             else:
   3592                 indexer = np.arange(len(self.items))[isnull(self.items)]

/usr/local/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   2393                 return self._engine.get_loc(key)
   2394             except KeyError:
-> 2395                 return self._engine.get_loc(self._maybe_cast_indexer(key))
   2396 
   2397         indexer = self.get_indexer([key], method=method, tolerance=tolerance)

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc (pandas/_libs/index.c:5239)()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc (pandas/_libs/index.c:5085)()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item (pandas/_libs/hashtable.c:20405)()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item (pandas/_libs/hashtable.c:20359)()

KeyError: 12

ideas for grouping

I think grouping could still be a lot easier. Here is an example with the Plotly syntax:

import pandas as pd
df = pd.read_csv('http://www.stat.ubc.ca/~jenny/notOcto/STAT545A/examples/gapminder/data/gapminderDataFiveYear.txt', sep='\t')


py.iplot([
            {
                    'x': df[df['year']==year]['gdpPercap'],
                    'y': df[df['year']==year]['lifeExp'],
                    'name': year, 'mode': 'markers',
            } for year in [1952, 1982, 2007]
], filename='cufflinks/scatter-group-by')

with a groupBy and groupVals key that segments by traces, this could be a on-liner with:

df.iplot(x='gdpPercap', y='lifeExp', groupBy='year', groupVals=[1952, 1982, 2007])

where groupVals is pd.unique(df[groupBy]) by default.

This could be extended to subplots really nicely too, where you could swap groupBy with rows and/or cols to split the traces out into multiple subplots.

Stacked area chart tooltips show cumulative y value instead of trace value

Cufflinks features a stacked area plot to complement the stacked bar chart (which is awesome). However, the tooltips on the stacked are show the cumulative height along the y axis rather than the value of the data represented by that trace at that x value. Cufflinks should implement the stacked area with original values as addressed in the plotly docs as the default option. This would be consistent with the tooltips in other charting tools that support tooltips like Excel and ChartIO. The existing behavior can be retained as an option if it is useful.

screen shot 2016-12-08 at 1 55 34 pm
Stacked Bar in plotly + cufflinks

screen shot 2016-12-08 at 1 55 51 pm
Stacked Area in plotly + cufflinks

screen shot 2016-12-08 at 2 09 46 pm

Stacked Area in Excel

Support for grouping in line/scatter plots

Would it make sense to add support for grouping for line and scatter plots (and maybe others)?

If so, it might be nice to use df.groupby('column_A').iplot(...) API for that, as well as for the existing grouping feature available for bar plots.

Sharing="Secret" Gives "404 Error" in Cufflinks

I'm using Python3 and configured Cufflinks to use cf.set_config_file(sharing="secret", offline=False).

However, when the iframe is embedded in an HTML document, I receive the error:

404 Plot twist! There's nothing here...

But the same plot directly implemented with Python without Cufflinks displays fine in HTML. The plot only displays if I'm logged in to Plotly in the same browser I'm using to view the HTML. I'm thinking this is the behaviour for sharing="private"

Is my cf.set_config_file() incomplete?
image

go_offline in iPython Notebook Breaks LaTeX Renderings

When I run this in a code cell:
import cufflinks as cf
cf.go_offline()

Then this in a markdown cell:
$$
X=\left{ \begin{array}{rl}
null &\mbox{ if $S+F=0$}
\frac{A}{B+C} &\mbox{ if $S+F&gt;0$}
\end{array} \right.
$$

I end up with this as a result:
$$ SR=\left{ \begin{array}{rl} null &\mbox{ if $S+F=0$} \ \frac{S}{S+F} &\mbox{ if $S+F&gt;0$} \end{array} \right. $$

'Line' Not Allowed in Histogram

I'm following the cufflinks tutorials on plotly word for word and anytime I try to make a histogram, including dataframe scatter matrices, I get the following error:

PlotlyDictKeyError: 'line' is not allowed in 'histogram'

Path To Error: ['line']

Valid attributes for 'histogram' at path [] under parents []:

    ['dx', 'orientation', 'stream', 'zsrc', 'ysrc', 'xbins', 'xsrc',
    'visible', 'marker', 'y0', 'tsrc', 'uid', 'showlegend', 'error_x',
    'error_y', 'rsrc', 'xaxis', 'text', 'bardir', 'type', 'opacity',
    'legendgroup', 'nbinsx', 'nbinsy', 'textsrc', 'histfunc', 'hoverinfo',
    'x0', 'ybins', 'autobiny', 'autobinx', 'name', 'yaxis', 'dy',
    'histnorm', 'r', 't', 'y', 'x', 'z']

I tried reinstalling cufflinks (successfully), to no avail. Any ideas?

This is the code I'm using:

import plotly.plotly as py
import cufflinks as cf
import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.randn(1000, 4), columns=['a', 'b', 'c', 'd'])
df.scatter_matrix(filename='cufflinks/scatter-matrix', world_readable=True)

and...

df = pd.DataFrame({'a': np.random.randn(1000) + 1,
                   'b': np.random.randn(1000),
                   'c': np.random.randn(1000) - 1})
df.iplot(kind='histogram', filename='cufflinks/basic-histogram')

(Sorry if this is an inappropriate place to ask this question, if it is, please direct me to somehwere more appropriate and I'll ask it there.)

VSpan argument incompatiable with plotly.graph_objs.Layout

Thanks for providing us with an awesome library!

When I try to call

import pandas as pd
import cufflinks as cf
import plotly.graph_objs as go

x.iplot(world_readable=False, filename='test/test',
                          vspan = [{
                            'x0': '2015-01-01', 'x1': '2015-12-31',
                            'color': 'teal', 'fill': True, 'opacity': .4}],
                          layout=go.Layout(title='title',
                            xaxis1=dict(title='date',tickfont=dict(size=18)),
                            yaxis1=dict(title='y',range=[0,100],tickfont=dict(size=18))))

It seems that the vspan argument is ignored. I have tried to use shapes as an argument with go.Layout, however its actually go.Scatter(layout) that can use the shapes parameter, not go.Layout. Any ideas on how to include both a vspan and a layout object?

Cheers,

Jack

Error when making a Histogram.

Hello,

I'm currently running Python 2.7 with Cufflinks 0.6.7 and end up with a PlotlyDictKeyError everytime I make a histogram. Even just running code from [here](https://plot.ly/ipython-notebooks/cufflinks/ gives me the same error.).

Error is:

PlotlyDictKeyError: 'line' is not allowed in 'histogram'

Path To Error: ['line']

Valid attributes for 'histogram' at path [] under parents []:

['dx', 'orientation', 'stream', 'zsrc', 'ysrc', 'xbins', 'xsrc',
'visible', 'marker', 'y0', 'tsrc', 'uid', 'showlegend', 'error_x',
'error_y', 'rsrc', 'xaxis', 'text', 'bardir', 'type', 'opacity',
'legendgroup', 'nbinsx', 'nbinsy', 'textsrc', 'histfunc', 'hoverinfo',
'x0', 'ybins', 'autobiny', 'autobinx', 'name', 'yaxis', 'dy',
'histnorm', 'r', 't', 'y', 'x', 'z']

Run <histogram-object>.help('attribute') on any of the above.
'' is the object at []

log scale

log scale is supported and works well.
The label is given with letter (k, µ,n, ...) but I was wondering is there is a way to use power instead (10-n) ?

Thanks

Unable to import cufflinks; importerror no module named 'plotlytools'

Hi,

When I try to import the cufflinks library into my Python environment I'm getting an ImportError.

My environment:
Windows 8.1 64bit
WinPython 64bit running Python 3.4.3

From what I can see all the files are structured correctly in the proper WinPython environment. Any ideas what could be causing the issue?

cufflinks_importerror

code error?

[in]
cf.datagen.sinwave(10,.25).iplot(kind='surface',theme='solar',colorscale='brbg',title='Cufflinks - Surface Plot',margin=(0,0,0,0))
[out]

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-10-51640e31aa23> in <module>()
      1 cf.datagen.sinwave(10,.25).iplot(kind='surface',theme='solar',colorscale='brbg',title='Cufflinks - Surface Plot',
----> 2                                  margin=(0,0,0,0))

/usr/local/lib/python2.7/dist-packages/cufflinks/plotlytools.pyc in _iplot(self, data, layout, filename, sharing, kind, title, xTitle, yTitle, zTitle, theme, colors, colorscale, fill, width, dash, mode, symbol, size, barmode, sortbars, bargap, bargroupgap, bins, histnorm, histfunc, orientation, boxpoints, annotations, keys, bestfit, bestfit_colors, mean, mean_colors, categories, x, y, z, text, gridcolor, zerolinecolor, margin, labels, values, secondary_y, subplots, shape, error_x, error_y, error_type, asFrame, asDates, asFigure, asImage, dimensions, asPlot, asUrl, online, **kwargs)
    584         layout=tools.getLayout(theme=theme,xTitle=xTitle,yTitle=yTitle,zTitle=zTitle,title=title,barmode=barmode,
    585                                                                 bargap=bargap,bargroupgap=bargroupgap,annotations=annotations,gridcolor=gridcolor,
--> 586                                 zerolinecolor=zerolinecolor,margin=margin,is3d='3d' in kind,**l_kwargs)
    587 
    588         if not data:

/usr/local/lib/python2.7/dist-packages/cufflinks/tools.pyc in getLayout(theme, title, xTitle, yTitle, zTitle, barmode, bargap, bargroupgap, gridcolor, zerolinecolor, margin, annotations, is3d, **kwargs)
    165                         margin=margin
    166                 else:
--> 167                         margin=dict(list(zip(('l','r','b','t')),margin))
    168                 layout.update(margin=margin)
    169 

TypeError: list() takes at most 1 argument (2 given)

do you mean these?

[in]
margin=(0,0,0,0)
dict(list(zip(('l','r','b','t')),margin))
[out]

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-17-de394516c4a5> in <module>()
      1 margin=(0,0,0,0)
----> 2 dict(list(zip(('l','r','b','t')),margin))

TypeError: list() takes at most 1 argument (2 given)

[in]
margin=(0,0,0,0)
dict(list(zip(('l','r','b','t'),margin)))
[out]

{'b': 0, 'l': 0, 'r': 0, 't': 0}

Can I add hline or vline on candle plot ?

Its ok to add hline in iplot when kind='line' , but fail when kind='candle'

df[-60:].iplot(kind='candle', hline=[2,4])

Could it be possible or how can I add hline on exist candle plot ?

Thanks

Objects as labels raise, as they aren't coerced to strings

If these were coerced with str(obj), they'd be easily JSON-able.

I'm using a pandas Period here as a convenient well known object; this isn't Period-specific.

pd.DataFrame({pd.Period('20150101'): [1,2,3]}).iplot()

TypeError                                 Traceback (most recent call last)
<ipython-input-14-cebfba5820d8> in <module>()
      1 import datetime
----> 2 pd.DataFrame({pd.Period('20150101'): [1,2,3]}).iplot()

/usr/local/lib/python2.7.11/lib/python2.7/site-packages/cufflinks/plotlytools.pyc in _iplot(self, data, layout, filename, sharing, kind, title, xTitle, yTitle, zTitle, theme, colors, colorscale, fill, width, dash, mode, symbol, size, barmode, sortbars, bargap, bargroupgap, bins, histnorm, histfunc, orientation, boxpoints, annotations, keys, bestfit, bestfit_colors, mean, mean_colors, categories, x, y, z, text, gridcolor, zerolinecolor, margin, labels, values, secondary_y, subplots, shape, error_x, error_y, error_type, asFrame, asDates, asFigure, asImage, dimensions, asPlot, asUrl, online, **kwargs)
    869                 return py.plot(figure,sharing=sharing,filename=filename,validate=validate,auto_open=False)
    870         else:
--> 871                 return iplot(figure,sharing=sharing,filename=filename,validate=validate,online=online)
    872 
    873 

/usr/local/lib/python2.7.11/lib/python2.7/site-packages/cufflinks/plotlytools.pyc in iplot(data_or_figure, validate, sharing, filename, online, **kwargs)
    970                 show_link = auth.get_config_file()['offline_show_link']
    971                 link_text = auth.get_config_file()['offline_link_text']
--> 972                 return offline.py_offline.iplot(data_or_figure,show_link=show_link,link_text=link_text)
    973         else:
    974                 if 'layout' in data_or_figure:

/usr/local/lib/python2.7.11/lib/python2.7/site-packages/plotly/offline/offline.pyc in iplot(figure_or_data, show_link, link_text, validate)
    187     plot_html, plotdivid, width, height = _plot_html(
    188         figure_or_data, show_link, link_text, validate,
--> 189         '100%', 525)
    190 
    191     display(HTML(plot_html))

/usr/local/lib/python2.7.11/lib/python2.7/site-packages/plotly/offline/offline.pyc in _plot_html(figure_or_data, show_link, link_text, validate, default_width, default_height)
     95 
     96     plotdivid = uuid.uuid4()
---> 97     jdata = json.dumps(figure.get('data', []), cls=utils.PlotlyJSONEncoder)
     98     jlayout = json.dumps(figure.get('layout', {}), cls=utils.PlotlyJSONEncoder)
     99 

/usr/local/lib/python2.7.11/lib/python2.7/json/__init__.pyc in dumps(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, encoding, default, sort_keys, **kw)
    249         check_circular=check_circular, allow_nan=allow_nan, indent=indent,
    250         separators=separators, encoding=encoding, default=default,
--> 251         sort_keys=sort_keys, **kw).encode(obj)
    252 
    253 

/usr/local/lib/python2.7.11/lib/python2.7/site-packages/plotly/utils.pyc in encode(self, o)
    143 
    144         # this will raise errors in a normal-expected way
--> 145         encoded_o = super(PlotlyJSONEncoder, self).encode(o)
    146 
    147         # now:

/usr/local/lib/python2.7.11/lib/python2.7/json/encoder.pyc in encode(self, o)
    205         # exceptions aren't as detailed.  The list call should be roughly
    206         # equivalent to the PySequence_Fast that ''.join() would do.
--> 207         chunks = self.iterencode(o, _one_shot=True)
    208         if not isinstance(chunks, (list, tuple)):
    209             chunks = list(chunks)

/usr/local/lib/python2.7.11/lib/python2.7/json/encoder.pyc in iterencode(self, o, _one_shot)
    268                 self.key_separator, self.item_separator, self.sort_keys,
    269                 self.skipkeys, _one_shot)
--> 270         return _iterencode(o, 0)
    271 
    272 def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,

/usr/local/lib/python2.7.11/lib/python2.7/site-packages/plotly/utils.pyc in default(self, obj)
    209             except NotEncodable:
    210                 pass
--> 211         return json.JSONEncoder.default(self, obj)
    212 
    213     @staticmethod

/usr/local/lib/python2.7.11/lib/python2.7/json/encoder.pyc in default(self, o)
    182 
    183         """
--> 184         raise TypeError(repr(o) + " is not JSON serializable")
    185 
    186     def encode(self, o):

TypeError: Period('2015-01-01', 'D') is not JSON serializable

pie chart subplots

pie chart subplots are created slightly differently than cartesion subplots - they use the domain property inside the traces. Here is an example: https://plot.ly/python/pie-charts/#pie-chart-subplots

would be cool if this were supported. my attempt was something along the lines of:

cf.tools.subplots([df.iplot(kind='pie', labels='a', values=c, asFigure=True) for c in ['a', 'b', 'c', 'd']])

`kind='scatter'` doesn't support `text` array

example:

import pandas as pd
df = pd.read_csv('http://www.stat.ubc.ca/~jenny/notOcto/STAT545A/examples/gapminder/data/gapminderDataFiveYear.txt', sep='\t')
df[df.year==2007].iplot(kind='scatter', mode='markers', x='gdpPercap', y='lifeExp', text='country')

In plotly, we support text on bar, scatter (+bubble, mode=markers and lines), scatter3d

dimensions arg not propogated to .getLayout method

Hi @santosjorge,

Thanks for the great library. Since plot.ly has been open sourced, I've been using cufflinks all the time to great fanfare. Kudos.

It seems that the dimensions argument in an .iplot call isn't passed through to the subsequent .getLayout method in generation of a plotly Layout object with defined height and widths. This prevents creating a Plotly visualization when working interactively (e.g., offline in Jupyter notebook). Is this by design / intentional?

Minimal working example, demonstrating the resultant Layout dict repr not containing height or width.

In [1]:  import cufflinks as cf
In [2]: cf.datagen.lines().iplot(asFigure=True, dimensions=(500, 500)).layout

{ 'legend': {'bgcolor': '#F5F6F9', 'font': {'color': '#4D5663'}},
 'paper_bgcolor': '#F5F6F9',
 'plot_bgcolor': '#F5F6F9',
 'titlefont': {'color': '#4D5663'},
 'xaxis1': {'gridcolor': '#E1E5ED',
  'showgrid': True,
  'tickfont': {'color': '#4D5663'},
  'title': '',
  'titlefont': {'color': '#4D5663'},
  'zerolinecolor': '#E1E5ED'},
 'yaxis1': {'gridcolor': '#E1E5ED',
  'showgrid': True,
  'tickfont': {'color': '#4D5663'},
  'title': '',
  'titlefont': {'color': '#4D5663'},
  'zerolinecolor': '#E1E5ED'}}

I have a quick fix for this (if it is indeed an issue), and will submit a PR shortly—thanks! :)

Add support for categories

It looks like categories are not supported.

The following fails with an exception:

from plotly.offline import init_notebook_mode, iplot
import pandas as pd
import cufflinks as cf
cf.go_offline()
init_notebook_mode()

df = pd.DataFrame({'x': [1,2,3,4], 'y': ['A', 'B', 'C', 'D']})
df['y'] = df['y'].astype('category')
df.set_index('y').iplot(kind='bar')
df.set_index('y').columns

And the following fails silently:

df = pd.DataFrame({'x': [1,2,3,4], 'y': ['A', 'B', 'C', 'D']})
df['y'] = df['y'].astype('category')
df.set_index('y').T.iplot(kind='bar')
df.set_index('y').T.columns

Categories in pandas are a great feature and I'd love to see them supported!

python 2 compatibility?

I'm wondering if your library is intended to be Python 2 compatible? Importing it yields a problem with the very first import here:

from . import date_tools

I've added

from __future__ import absolute_import

at the top of the init file and I was at least able to import the library and use cf.datagen.lines().

Licence file missing

There seems to be no licence file in the repo, is this correct?
In the setup.py file there's a MIT licence indication, so it would probably be best to add the file as well.

Trouble with TA Lib

I just installed this for the first time, and having trouble using it.

The error I'm getting is "no module named talib" when I import cufflinks.

I ran brew install talib. Are there other steps involved? Running pip install TA-Lib also fails on the gcc command (fatal error: 'ta-lib/ta_defs.h' file not found).

How can I get a hold of v0.10 in the meantime? I'd love to take this for a spin.

showing multiple small graphs in a notebook cell output

For example: assume each row can show 3 figures (maybe we can also adjust the number for very big displays), the output could be:

fig0 fig1 fig2
fig3 fig4 fig5
fig6 ...

when we click a figure, it can expand to 100% in width.

This is very important for dense experiment work, such as CNN (Deep learning). We can plot neuron weights for many neurons (a heatmap for each neuron) easily. And we don't lose global views.

We don't use subplot because it needs to determine the numbers first and we need to hold the handle of a panel. (We don't like too much intrusive code in the framework for assist purpose)

Do you think it can be integrated in cufflinks?

Javascript error in jupyter on cufflinks Import

I am using datepicker widget given in Ipywidgets example along with plotly, Whenever I import cufflinks for plotting I start to get following javascript error: TypeError: require is not a function

Requiring 'core' in python 3.4.3

Using newest Ananconda install with python 3.4.3. In notebook !pip install cufflinks works, but importing set_confog_file return erros requiring datetool. This install sucessfully also using !pip install, but importing set_config_file then requires core. Install of core returns: Could not find a version that satisfies the requirement core (from versions: )
No matching distribution found for core

Chart Dimensions config

Is there a way to set a default chart dimension? Currently, the charts default to a size that exceeds my cell output window so all charts have a horizontal scroll bar. I've gotten around it by using dimensions but was wondering if it was possible to have the dimensions set by default.

multiple chart types?

hey @santosjorge - thoughts on the best way to plot multiple chart types, i.e. a bar and a line?

type as an array or a dict, sort of like how secondary_y works:

df = pd.DataFrame({
     'y1': [3, 1, 5], 
     'y2': [30, 50, 20]
}, index=[1, 2, 3])

df.iplot(kind={'y1': 'bar', 'y2': 'scatter'})

df.iplot(kind=['bar', 'scatter'])

this pattern could apply to any of the non-array figure properties, e.g.

df.iplot(mode=['markers', 'text'], marker=[{'color': 'blue}, {'color': 'red'}])

cannot import name date_tools

Have updated plotly and cufflinks, but am getting this weird error I've never seen before.

In [120]: import cufflinks
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-120-727a8f30b326> in <module>()
----> 1 import cufflinks

/usr/local/lib/python2.7/site-packages/cufflinks/__init__.py in <module>()
      9 from __future__ import absolute_import
     10
---> 11 from . import date_tools
     12 from . import utils
     13 from . import datagen

ImportError: cannot import name date_tools

And cufflinks installed:

Requirement already up-to-date: cufflinks in /usr/local/lib/python2.7/site-packages
Requirement already up-to-date: pandas in /usr/local/lib/python2.7/site-packages (from cufflinks)
Requirement already up-to-date: plotly>=2.0.0 in /usr/local/lib/python2.7/site-packages (from cufflinks)
Requirement already up-to-date: colorlover>=0.2 in /usr/local/lib/python2.7/site-packages (from cufflinks)
Requirement already up-to-date: python-dateutil in /usr/local/lib/python2.7/site-packages (from pandas->cufflinks)
Requirement already up-to-date: numpy>=1.7.0 in /usr/local/lib/python2.7/site-packages (from pandas->cufflinks)
Requirement already up-to-date: pytz>=2011k in /usr/local/lib/python2.7/site-packages (from pandas->cufflinks)
Requirement already up-to-date: six in /Users/chase.schwalbach/Library/Python/2.7/lib/python/site-packages (from plotly>=2.0.0->cufflinks)
Requirement already up-to-date: nbformat>=4.2 in /usr/local/lib/python2.7/site-packages (from plotly>=2.0.0->cufflinks)
Requirement already up-to-date: requests in /usr/local/lib/python2.7/site-packages (from plotly>=2.0.0->cufflinks)
Requirement already up-to-date: decorator>=4.0.6 in /Users/chase.schwalbach/Library/Python/2.7/lib/python/site-packages (from plotly>=2.0.0->cufflinks)
Requirement already up-to-date: jsonschema!=2.5.0,>=2.4 in /usr/local/lib/python2.7/site-packages (from nbformat>=4.2->plotly>=2.0.0->cufflinks)
Requirement already up-to-date: ipython-genutils in /Users/chase.schwalbach/Library/Python/2.7/lib/python/site-packages (from nbformat>=4.2->plotly>=2.0.0->cufflinks)
Requirement already up-to-date: jupyter-core in /usr/local/lib/python2.7/site-packages (from nbformat>=4.2->plotly>=2.0.0->cufflinks)
Requirement already up-to-date: traitlets>=4.1 in /Users/chase.schwalbach/Library/Python/2.7/lib/python/site-packages (from nbformat>=4.2->plotly>=2.0.0->cufflinks)
Requirement already up-to-date: certifi>=2017.4.17 in /usr/local/lib/python2.7/site-packages (from requests->plotly>=2.0.0->cufflinks)
Requirement already up-to-date: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/site-packages (from requests->plotly>=2.0.0->cufflinks)
Requirement already up-to-date: urllib3<1.22,>=1.21.1 in /usr/local/lib/python2.7/site-packages (from requests->plotly>=2.0.0->cufflinks)
Requirement already up-to-date: idna<2.6,>=2.5 in /usr/local/lib/python2.7/site-packages (from requests->plotly>=2.0.0->cufflinks)
Requirement already up-to-date: functools32; python_version == "2.7" in /usr/local/lib/python2.7/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2->plotly>=2.0.0->cufflinks)
Requirement already up-to-date: enum34; python_version == "2.7" in /Users/chase.schwalbach/Library/Python/2.7/lib/python/site-packages (from traitlets>=4.1->nbformat>=4.2->plotly>=2.0.0->cufflinks)

macOS Sierra
python 2.7.13

ability to set `'index'` as an `'x'` or `'y'`

Example:

df = pd.DataFrame(np.random.randn(1000, 2), columns=['B', 'C']).cumsum()
df.iplot(x='index', y='B')

Note that the plotly son encoder also parses index's, so this would be something like:

py.iplot([{'x': df.index, 'y': df.B}])

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.