-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MultiIndex - Comparison with Mixed Frequencies (and other FUBAR) #17112
Comments
Yikes! I can't really follow your last code snippet (not sure what
Yeah...that does look a little weird. Can you try first upgrading to |
That's the real-life column (2770 rows). Looks a lot like
On the plus side its clearly a user error (this guy). Ideally it'd be caught in
Unchanged. |
I still don't get why
Especially in py3, we unsortable errors to be Having the |
¯ \ (ツ)/¯ Feel free to experiment and see what happens when you loosen that restriction 😄 |
There are more effective approaches than trial and error. Someone somewhere knows why this decision was made in the first place. |
Perhaps, but I'm assuming worst case in that we don't remember anymore why that is the case. |
well, you need to factorize things when you construct a MI. Not really sure what this issue is about, it has gone off on tangents. Can you provide a narrow clear example. |
@gfyoung don't tag things until it is clear what they are. |
Setup:
Clear Error:
Incorrect Error Message (I think because
py3
|
This results in the same error: In [2]: pd.Index([pd.Timestamp('2000-01-03 00:00:00', freq='B'),
pd.Period('2000-01-03', 'B'),
pd.Period('2000-01-03', 'B')]).sort_values()
[...]
SystemError: <built-in function isinstance> returned a result with an error set |
Setup:
In the real-life version of this issue, 'Period' is a column in a DataFrame and I need to append it as a new level to the index. The snippets here show the problem(s) in both py2 and py3, but for reasons unknown
df.set_index('Period', append=True)
goes through fine in py2.The large majority of Period values are quarterly-frequency.
py2
No idea why it thinks Categorical is relevant here. That doesn't happen in py3.
For the purposes of
sort_values
, refusing to sort might make sense. But when all I care about isset_index
, I'm pretty indifferent to the ordering.py3
I have no idea what to make of this.
A problem that I have not been able to replicate with a copy/pasteable subset of the data:
AFAICT it took the name 'Period' and made that the only value in the new level of the MultiIndex. Really no idea what's going on here.
The text was updated successfully, but these errors were encountered: