Weird Error Groupby : works with .sum(), but throws error with .rank()
I am working with a multiindex dataframe.

Applying:

    df.groupby(level).sum()

Works FINE

However, applying:

    df.groupby(level).rank()

throws me the following error:

    ValueError: Categorical categories must be unique

Important note: I am working with 4 levels. I am grouping by using the first 3 levels. 
The fourth level is a vector of dates, the same for all the index levels. 
To be as specific as possible, I have 90 different index levels.

The error is threw only when my overall multiindex dataframe exceeds 10000 rows. Meaning that each index levels as over or 112 days of data. 

Using tail(), I noticed that when it is 9990 rows (111 days per index level), it gives me the rank... adding an additional day throws me the error.

I checked the specific day, but it looks fine.

I then added additional layers in the first three levels, meaning that instead of having 90 index levels, I now have more. And the scenario repeats itself. It throws me the error when the multiindex dataframe len is > 10000. Below, it gives me the rank.

Anyone had this error before? I am having a very hard time understanding where it comes from.