-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: to_dense now preserves dtype in SparseArray #10655
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
Conversation
Also fixes values and get_values. closes pandas-dev#10648
@@ -266,7 +266,8 @@ def to_dense(self, fill=None): | |||
# fill the nans | |||
if fill is None: | |||
fill = self.fill_value | |||
if not np.isnan(fill): | |||
# nans can only occur arrays of floating scalars | |||
if np.issubdtype(self.dtype, np.inexact) and not np.isnan(fill): |
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.
a better way to do this is just use isnull
which handles all of these things.
@jreback sorry for being slow in getting back to this, I'll make the changes requested before the week is out. |
can you update |
@ebolyen can you update according to comments. need a whatsnew note as well. |
assert_almost_equal(self.arr.values, self.arr_data) | ||
assert_almost_equal(self.arr.to_dense(), self.arr_data) | ||
assert_almost_equal(self.arr.sp_values, np.asarray(self.arr)) | ||
for arr, arr_data in ((self.arr, self.arr_data), |
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.
include the issue number as a comment here
can you update according to comments |
closing, but pls reopen if you'd like to work on this again. |
Also fixes values and get_values.
fixes #10648