Skip to content

examples/misc/longshort.py is outdated #6866

@anntzer

Description

@anntzer

As of master / numpy 1.11:

$ python2 examples/misc/longshort.py
Traceback (most recent call last):
  File "examples/misc/longshort.py", line 24, in <module>
    r1 = mlab.rec_append_fields(r1, 'gains', gains1)
  File "/home/antony/src/extern/matplotlib/lib/matplotlib/mlab.py", line 2389, in rec_append_fields
    newdtype = np.dtype(rec.dtype.descr + list(zip(names, dtypes)))
TypeError: data type not understood

$ python3 examples/misc/longshort.py
Traceback (most recent call last):
  File "examples/misc/longshort.py", line 12, in <module>
    u1 = urllib.urlretrieve('http://ichart.finance.yahoo.com/table.csv?s=AAPL&d=9&e=14&f=2008&g=d&a=8&b=7&c=1984&ignore=.csv')
AttributeError: module 'urllib' has no attribute 'urlretrieve'

Basically mlab.rec_append_fields has some unicode/bytes issues on Py2 and the imports need to be renamed on Py3 (I guess).

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions