-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: AttributeError raised by map inside groupby reduction #29160
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
Changes from all commits
155406f
f18144d
4180d3b
69426cc
e652b0d
4582436
5a0ab54
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -731,7 +731,9 @@ def astype(self, dtype, copy=True): | |
# Ensure that self.astype(self.dtype) is self | ||
return self | ||
|
||
new_values = self._data.astype(dtype, copy=copy) | ||
# use _eadata since _data links to _index_data which can be | ||
# overwritten in groupby-reduction | ||
new_values = self._eadata.astype(dtype, copy=copy) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain why this is needed in And it's not possible to prevent that _data gets written in the first place? (or is it done in a try/except that only fails later .. ). Adding yet another data like attribute doesn't seem ideal .. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Take a look at how we patch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we make the (didn't look in detail, so this might be nonsense) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Based on a quick test, it seems that setattr still goes through a property's setter (now, if the actual idea can help, I would need to take a further look) Do you have an example test that hits this (a failing test if you don't do the above change) ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If you make the groupby change to stop catching AttributeError but don't change the index code, there is a test (dont know which off the top of my head) that raises an AttributeError in |
||
|
||
# pass copy=False because any copying will be done in the | ||
# _data.astype call above | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to remove AttributeError from the clause below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you indicate where the errors come from here as much as possible