Skip to content

ENH: Series from MultiIndex causes segfault #4187

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
hayd opened this issue Jul 10, 2013 · 9 comments · Fixed by #4190
Closed

ENH: Series from MultiIndex causes segfault #4187

hayd opened this issue Jul 10, 2013 · 9 comments · Fixed by #4190

Comments

@hayd
Copy link
Contributor

hayd commented Jul 10, 2013

In [3]: m = pd.MultiIndex.from_arrays([[1,2], [3,4]])

In [4]: m
Out[4]:
MultiIndex
[(1, 3), (2, 4)]

In [5]: pd.Series(m)
[1]    786 segmentation fault  ipython

pd.Series(m.values) has same fault (list of tuples)

Probably this should just be disallowed.

@hayd
Copy link
Contributor Author

hayd commented Jul 10, 2013

Perhaps this should return (not sure):

In [11]: m.to_series()
Out[11]:
1  3    (1, 3)
2  4    (2, 4)
dtype: object

@hayd
Copy link
Contributor Author

hayd commented Jul 10, 2013

pushing out a fix to NotImplementedError.

Could just as easily return data.to_series(), thoughts?

@jreback
Copy link
Contributor

jreback commented Jul 10, 2013

works for the index case, but not for list of tuples (I would just do NotImplementedError for now)

@hayd
Copy link
Contributor Author

hayd commented Jul 10, 2013

@jreback what do you mean not for the list of tuples?

In [4]: pd.Series([(1,2), (3,4)])
Out[4]:
0    (1, 2)
1    (3, 4)
dtype: object

@jreback
Copy link
Contributor

jreback commented Jul 10, 2013

hmm...must have been a typo...nvm

@cpcloud
Copy link
Member

cpcloud commented Jul 13, 2013

what's causing the segfault here

@hayd
Copy link
Contributor Author

hayd commented Jul 13, 2013

@cpcloud that's really weird, what was it doing? Was it just me?

@cpcloud
Copy link
Member

cpcloud commented Jul 13, 2013

i can't repro it

In [1]: paste
In [3]: m = pd.MultiIndex.from_arrays([[1,2], [3,4]])
## -- End pasted text --

In [2]: Series(m)
Out[2]: Series([], dtype: object)

In [3]: m
Out[3]:
MultiIndex
[(1, 3), (2, 4)]

In [4]: Series(m.values)
Out[4]:
0    (1, 3)
1    (2, 4)
dtype: object

In [5]: pd.__version__
Out[5]: '0.12.0.dev-e2638e0'

this is the commit right before this PR

@jtratner
Copy link
Contributor

I was getting a segfault on this too.
On Jul 13, 2013 2:29 PM, "Phillip Cloud" [email protected] wrote:

i can't repro it

In [1]: paste
In [3]: m = pd.MultiIndex.from_arrays([[1,2], [3,4]])

-- End pasted text --

In [2]: Series(m)
Out[2]: Series([], dtype: object)

In [3]: m
Out[3]:
MultiIndex
[(1, 3), (2, 4)]

In [4]: Series(m.values)
Out[4]:
0 (1, 3)
1 (2, 4)
dtype: object

In [5]: pd.version
Out[5]: '0.12.0.dev-e2638e0'

this is the commit right before this PR


Reply to this email directly or view it on GitHubhttps://github.com//issues/4187#issuecomment-20924244
.

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

Successfully merging a pull request may close this issue.

4 participants