Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

ebolyen
Copy link

@ebolyen ebolyen commented Jul 22, 2015

Also fixes values and get_values.

fixes #10648

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):
Copy link
Contributor

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 jreback added Bug Dtype Conversions Unexpected or buggy dtype conversions Sparse Sparse Data Type labels Jul 24, 2015
@jreback jreback added this to the 0.17.0 milestone Jul 24, 2015
@ebolyen
Copy link
Author

ebolyen commented Aug 11, 2015

@jreback sorry for being slow in getting back to this, I'll make the changes requested before the week is out.

@jreback
Copy link
Contributor

jreback commented Aug 20, 2015

can you update

@jreback
Copy link
Contributor

jreback commented Aug 26, 2015

@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),
Copy link
Contributor

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

@jreback
Copy link
Contributor

jreback commented Sep 1, 2015

can you update according to comments

@jreback jreback modified the milestones: Next Major Release, 0.17.0 Sep 2, 2015
@jreback
Copy link
Contributor

jreback commented Nov 10, 2015

closing, but pls reopen if you'd like to work on this again.

@jreback jreback closed this Nov 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Sparse Sparse Data Type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

to_dense does not preserve dtype in SparseArray
2 participants