8000 ValueError: setting an array element with a sequence. · Issue #9156 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

ValueError: setting an array element with a sequence. #9156

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
cancan101 opened this issue Dec 26, 2014 · 13 comments
Closed

ValueError: setting an array element with a sequence. #9156

cancan101 opened this issue Dec 26, 2014 · 13 comments
Labels
Compat pandas objects compatability with Numpy or Python functions

Comments

@cancan101
Copy link
Contributor

This works fine:

In [24]: np.asarray(np.array([np.asarray([10, 20])]), np.float32)

Out[24]:
array([[ 10.,  20.]], dtype=float32)

but this does not work:

In [25]: np.asarray(pd.Series([np.asarray([10, 20])]), np.float32)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-25-afb8b06bdf8c> in <module>()
----> 1 np.asarray(pd.Series([np.asarray([10, 20])]), np.float32)

/usr/local/lib/python2.7/dist-packages/numpy/core/numeric.pyc in asarray(a, dtype, order)
    460 
    461     """
--> 462     return array(a, dtype, copy=False, order=order)
    463 
    464 def asanyarray(a, dtype=None, order=None):

ValueError: setting an array element with a sequence.
@jreback
Copy link
Contributor
jreback commented Dec 26, 2014

pd.show_versions()

iirc this is a numpy bug fixing in next version

@cancan101
Copy link
Contributor Author
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 3.13.0-32-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.15.2
nose: 1.3.3
Cython: 0.20.2
numpy: 1.9.1
scipy: 0.14.0
statsmodels: None
IPython: 2.3.1
sphinx: None
patsy: None
dateutil: 2.3
pytz: 2014.10
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.3.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
httplib2: None
apiclient: None
rpy2: None
sqlalchemy: None
pymysql: None
psycopg2: None

8000

@cancan101
Copy link
Contributor Author

@jreback I appear to be on a pretty new version of numpy. Is the issues addressed only in a dev version?

@jreback
Copy link
Contributor
jreback commented Dec 27, 2014

iirc its a future issue
they don't handle Numpy array likes correctly

not sure why you would do this anyhow

@jreback jreback added Compat pandas objects compatability with Numpy or Python functions Usability labels Dec 27, 2014
@cancan101
Copy link
Contributor Author

It came up when trying to use Theano which takes the Dataframe / Series of features and attempts to convert to a numpy array.

@jreback
Copy link
Contributor
jreback commented Dec 27, 2014

they you ought to raise it with them. This is not standard practice to do this. It exposed a numpy bug.

closing as out-of-scope and other module compat.

@jreback jreback closed this as completed Dec 27, 2014
@cancan101
Copy link
Contributor Author

Do you think it is a numpy issue?

On Sat, Dec 27, 2014, 12:56 jreback notifications@github.com wrote:

Closed #9156 #9156.


Reply to this email directly or view it on GitHub
#9156 (comment).

@jreback
Copy link
Contributor
jreback commented Dec 27, 2014

that's what I said

@argriffing
Copy link

it is a numpy issue?

Maybe a numpy design flaw but not unambiguously a numpy bug. In my opinion issues like this will be resolved when pandas swaps out numpy for whatever next-gen technology Continuum or Enthought are building.

@jreback
Copy link
Contributor
jreback commented Dec 27, 2014

no this actually IS a numpy bug (they are not properly handling list-likes that are not subclassed of ndarray)

and when dynd becomes main stream it will just be a different set of bugs (prob a lot less of course as the test suites exercise quite a lot).

:)

@argriffing
Copy link

no this actually IS a numpy bug

I personally might agree, but I'm not sure it is a consensus among numpy devs. I've seen some related numpy github issues, but do you have a link to the github issue that most clearly explains this bug? Or should we add a new one?

@jreback
Copy link
Contributor
jreback commented Dec 27, 2014

numpy/numpy#4240

though looking at it might be different (but still numpy issue)
if You would like to investigate further and possibly open a numpy issue go for it

@cancan101
Copy link
Contributor Author

@argriffing what do you think is the right thing for numpy to do in this case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions
Projects
None yet
Development

No branches or pull requests

3 participants
0