Skip to content

TST: Adding test to concat Sparse arrays #30645

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

Merged
merged 1 commit into from
Jan 6, 2020

Conversation

SdgJlbl
Copy link
Contributor

@SdgJlbl SdgJlbl commented Jan 3, 2020

Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SdgJlbl Thanks for the PR. suggested change works for me on windows. hopefully won't break other builds

# GH 23557
a = pd.Series(pd.SparseArray([0, 1, 2]))
expected = pd.DataFrame(data=[[0, 0], [1, 1], [2, 2]]).astype(
pd.SparseDtype("int", 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pd.SparseDtype("int", 0)
pd.SparseDtype(np.intp, 0)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, I've amended the PR with the change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to change this to np.int64 else the tests were failing on linux 32-bit

@simonjayhawkins simonjayhawkins added Sparse Sparse Data Type Testing pandas testing functions or related to the test suite labels Jan 3, 2020
@SdgJlbl SdgJlbl force-pushed the gh-23557-test-sparse-concat branch from 3cf64cb to 36e171c Compare January 4, 2020 10:15
@jreback jreback added the Reshaping Concat, Merge/Join, Stack/Unstack, Explode label Jan 4, 2020

def test_concat_sparse():
# GH 23557
a = pd.Series(pd.SparseArray([0, 1, 2]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add

from pandas.array import SparseArrary

at the top instead of directly using SparseArray as we are doing to deprecate that import.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 🙂

@SdgJlbl SdgJlbl force-pushed the gh-23557-test-sparse-concat branch from 36e171c to 93e3cc7 Compare January 6, 2020 09:40
@jreback jreback added this to the 1.0 milestone Jan 6, 2020
@jreback jreback merged commit 8cff0e1 into pandas-dev:master Jan 6, 2020
@jreback
Copy link
Contributor

jreback commented Jan 6, 2020

thanks @SdgJlbl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reshaping Concat, Merge/Join, Stack/Unstack, Explode Sparse Sparse Data Type Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: concat(Series[sparse]) raises ValueError
3 participants