santosjorge / cufflinks

Productivity Tools for Plotly + Pandas
MIT License
3.02k stars 675 forks source link

pip repo doesn't have pandas np fix and exclusively negative spreads are not visualized properly #287

Open danialramzan opened 4 months ago

danialramzan commented 4 months ago

I am reporting two issues:

  1. The cufflinks module on pip does not have the fix accounting for pandas deprecating pandas.np. There are two possible solutions for this.

    a) Fix it yourself: open the pip cufflinks module in your environment folder and replace all occurrences of pandas.np with np, after importing numpy as np at the top of the file in plotlytools.py.

    b) Replace the plotlytools.py file in your cufflinks folder with the one in this github repo, which has the required fixes.

  2. Spreads are not labelled consistently if the first column has consistently greater values than the second column. If this is the case, both the graph labels and values for yaxis2 are incoherent, and the spread approximates a right triangle shape. The solution for this appears to be changing the order of your columns to have the largest one first.

image

Data starting from 2018-01-12 is visualized normally because there exists at least one data point for which the first element in the ordered pair of columns is greater than the second element:

image

For data starting from 2018-01-13, when this is no longer true the issue manifests itself:

image