Johan Nilssons Lifestream

How to cut Pandas Series with non-unique bin edges?

I have a series of about 200000 values, >50% of which are NaN and 0. Ideally, I'd like to bin my values using qcut(), but that gives me an error due to non-unique bin edges. How would I categorize all the NaN values in fractile 1 and 0 values in fractile 2, and then the rest of the non-zero values in fractile labels 3 to 10 (assuming I want 10 fractiles)

via Stack Overflow

blog comments powered by Disqus
Get the source for phplifestream at Github