Giter VIP home page Giter VIP logo

Comments (9)

josesho avatar josesho commented on May 29, 2024 2

Closed with #89

from dabest-python.

BioinfoTongLI avatar BioinfoTongLI commented on May 29, 2024 1

Hello, FYI, this is not an issue causes by dabest.
Something is broken while Cythonizing the groupby.quantile in the version 0.25 of Pandas.
pandas-dev/pandas#20405 (comment)
pandas-dev/pandas#27526 (comment)
I believe the best solution, in short term, is to force people stay at 0.24

from dabest-python.

josesho avatar josesho commented on May 29, 2024

I also see this error, after upgrading to pandas==0.25.

The last traceback pointing to dabest is

~/anaconda3/envs/bleeding-edge/lib/python3.7/site-packages/dabest/plot_tools.py in gapped_lines(data, x, y, type, offset, ax, line_color, gap_width_percent, **kwargs)
    160 
    161     medians   = data.groupby(x)[y].median().reindex(index=group_order)
--> 162     quantiles = data.groupby(x)[y].quantile([0.25, 0.75])\
    163                                   .unstack()\
    164                                   .reindex(index=group_order)

Something has changed in df.groupby().quantile(). I will let you know when this is fixed. If you squash this earlier, feel free to do a pull request!

Thanks,
Joses

from dabest-python.

josesho avatar josesho commented on May 29, 2024

Ah ok, thanks @BioinfoTongLI for following this up! Let's wait for pandas=0.25.1 to be released.

from dabest-python.

schlegelp avatar schlegelp commented on May 29, 2024

Just to add that I am still getting an error (albeit different from OP) with pandas 0.25.1 and dabest 0.2.4 running the iris example in the README:

In [6]: iris_dabest.mean_diff.plot();                                           
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-6-be7fec275da2> in <module>
----> 1 iris_dabest.mean_diff.plot();

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dabest/_classes.py in plot(self, color_col, raw_marker_size, es_marker_size, swarm_label, contrast_label, swarm_ylim, contrast_ylim, custom_palette, swarm_desat, halfviolin_desat, halfviolin_alpha, float_contrast, show_pairs, group_summaries, group_summaries_offset, fig_size, dpi, swarmplot_kwargs, violinplot_kwargs, slopegraph_kwargs, reflines_kwargs, group_summary_kwargs, legend_kwargs)
   1233         del all_kwargs["self"]
   1234 
-> 1235         out = EffectSizeDataFramePlotter(self, **all_kwargs)
   1236 
   1237         return out

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dabest/plotter.py in EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs)
    375                          gap_width_percent=1.5,
    376                          type=group_summaries, ax=rawdata_axes,
--> 377                          **group_summary_kwargs)
    378 
    379 

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dabest/plot_tools.py in gapped_lines(data, x, y, type, offset, ax, line_color, gap_width_percent, **kwargs)
    160 
    161     medians   = data.groupby(x)[y].median().reindex(index=group_order)
--> 162     quantiles = data.groupby(x)[y].quantile([0.25, 0.75])\
    163                                   .unstack()\
    164                                   .reindex(index=group_order)

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/groupby/groupby.py in quantile(self, q, interpolation)
   1951             indices = np.concatenate(arrays)
   1952             assert len(indices) == len(result)
-> 1953             return result.take(indices)
   1954 
   1955     @Substitution(name="groupby")

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/series.py in take(self, indices, axis, is_copy, **kwargs)
   4430 
   4431         indices = ensure_platform_int(indices)
-> 4432         new_index = self.index.take(indices)
   4433 
   4434         if is_categorical_dtype(self):

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/indexes/multi.py in take(self, indices, axis, allow_fill, fill_value, **kwargs)
   2030             allow_fill=allow_fill,
   2031             fill_value=fill_value,
-> 2032             na_value=-1,
   2033         )
   2034         return MultiIndex(

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/indexes/multi.py in _assert_take_fillable(self, values, indices, allow_fill, fill_value, na_value)
   2058                 taken = masked
   2059         else:
-> 2060             taken = [lab.take(indices) for lab in self.codes]
   2061         return taken
   2062 

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/indexes/multi.py in <listcomp>(.0)
   2058                 taken = masked
   2059         else:
-> 2060             taken = [lab.take(indices) for lab in self.codes]
   2061         return taken
   2062 

IndexError: index 6 is out of bounds for size 6

from dabest-python.

BioinfoTongLI avatar BioinfoTongLI commented on May 29, 2024

@josesho It's my bad, I shouldn't close this...
I thought it will be solved rapidly...
Clearly it is not the case. I saw the issues is closed in pandas repo.
Someone can try a nightly build of pandas to see if it works?

from dabest-python.

josesho avatar josesho commented on May 29, 2024

The pandas developers tried a patch with 0.25.1, but there's still a problem...

I've opened an issue with them pandas-dev/pandas#28312.

I think the best option for now is to stick with pandas==0.24.

from dabest-python.

akdor1154 avatar akdor1154 commented on May 29, 2024

this seems to work with pandas 0.25.3 (pandas issue reckons it was fixed back in .2 but I haven't tested that). Any chance of relaxing the version restriction?

from dabest-python.

josesho avatar josesho commented on May 29, 2024

Hi @akdor1154, sorry for the delay; I just got back in the office. Thanks for the heads-up, I'll check out the latest pandas version and fix it ASAP over Christmas break

from dabest-python.

Related Issues (20)

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.