Skip to content

BUG: Don't multiply sets during construction #32594

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 11 commits into from
Mar 15, 2020
Merged

BUG: Don't multiply sets during construction #32594

merged 11 commits into from
Mar 15, 2020

Conversation

dsaxton
Copy link
Member

@dsaxton dsaxton commented Mar 10, 2020

@WillAyd
Copy link
Member

WillAyd commented Mar 11, 2020

Hmm how is this type of construction actually useful? If anything this should probably just raise

@WillAyd WillAyd added the Constructors Series/DataFrame/Index/pd.array Constructors label Mar 11, 2020
@dsaxton
Copy link
Member Author

dsaxton commented Mar 11, 2020

Hmm how is this type of construction actually useful? If anything this should probably just raise

Yeah, I could see that too. Looks like it does raise in the Series case so makes sense it would here too (or could treat sets as singletons, although that seems even less useful?)

@WillAyd
Copy link
Member

WillAyd commented Mar 11, 2020

If Series raises then I think that is even more motivation to raise here; this seems more likely to be a programmer error than intent

@@ -446,6 +446,8 @@ def sanitize_array(
# GH#16804
arr = np.arange(data.start, data.stop, data.step, dtype="int64")
subarr = _try_cast(arr, dtype, copy, raise_cast_failure)
elif isinstance(data, set):
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 use abc.Set

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

Lgtm

@jreback jreback added this to the 1.1 milestone Mar 15, 2020
@jreback jreback added the Bug label Mar 15, 2020
@jreback jreback merged commit 74f6579 into pandas-dev:master Mar 15, 2020
@jreback
Copy link
Contributor

jreback commented Mar 15, 2020

thanks @dsaxton

@dsaxton dsaxton deleted the set-construct branch March 15, 2020 00:42
SeeminSyed pushed a commit to CSCD01-team01/pandas that referenced this pull request Mar 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Constructors Series/DataFrame/Index/pd.array Constructors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating a column with a set replicates the set n times
4 participants