Skip to content
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

Improper handling of Series in Series constructor #1671

Closed
wesm opened this issue Jul 24, 2012 · 2 comments
Closed

Improper handling of Series in Series constructor #1671

wesm opened this issue Jul 24, 2012 · 2 comments
Assignees
Labels
Milestone

Comments

@wesm
Copy link
Member

wesm commented Jul 24, 2012

This looks like a regression that did not have a unit test (pretty sure this used to do the right thing)

index1 = ['d', 'b', 'a', 'c']
index2 = sorted(index1)
s1 = Series([4, 7, -5, 3], index=index1)
s2 = Series(s1, index=index2)

cc @hughdbrown

@ghost ghost assigned wesm Jul 24, 2012
@wesm wesm closed this as completed in 770af7d Aug 11, 2012
@manuteleco
Copy link

Hi,

I had some code that was relaying on the Series constructor the way it was before this bugfix. I was able to adapt it to the new version very easily, but I just wonder if this is the intended behavior now:

In [2]: Series(Series(["a"]), index=[2])
Out[2]: 2    NaN

when before you could do:

In [2]: Series(Series(["a"]), index=[2])
Out[2]: 2    a

Of course, you can still get the same result as before just by using the .values property:

In [3]: Series(Series(["a"]).values, index=[2])
Out[3]: 2    a

so, again, I'm just wondering if this is the intended behavior or maybe an unforeseen side-effect.

Thanks and regards.
Manu.

@wesm
Copy link
Member Author

wesm commented Aug 13, 2012

Yes. I never intended for this behavior:

In [2]: Series(Series(["a"]), index=[2])
Out[2]: 2    a

It's not consistent with how Series handles other data types, like dicts. It's been brought up to me by others, but I think unfortunately a lot of people have written code relying on the "bug" here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants