pysal / notebooks

jupyter/ipython notebooks demonstrating PySAL functionality
53 stars 38 forks source link

SyntaxError: Multiple notebooks #59

Open thedatalass opened 5 years ago

thedatalass commented 5 years ago

sparse_scipy_optim

def poiss_loglike(x, data, a):
    print x
    return -np.sum(data*np.log(x)-x)*a

params = sc.fmin(poiss_loglike, 0, args=(data ,1))
print params
File "<ipython-input-11-adb8f934fbcb>", line 2
    print x
          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(x)?

Sparse Categorical Bottleneck

File "<ipython-input-1-09b63899e645>", line 23
    print index                                                                    #the most intense part of the algorithm
              ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(index                                                                    #the most intense part of the algorithm)?

Sparse Categorical Speed

File "<ipython-input-6-a5621e230dc1>", line 3
    print np.allclose(spcategorical1(o).toarray(), spcategorical2(o).toarray())
           ^
SyntaxError: invalid syntax

NYC_Bike_Example

os.chdir('/Users/toshan/dev/pysal/pysal/contrib/spint')
from gravity import Gravity, Production, Attraction, Doubly

model = Gravity(flows, o_vars, d_vars, cost, 'exp')
print model.params
print model.deviance
  File "<ipython-input-2-72a7a70c129d>", line 5
    print model.params
              ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(model.params)
ljwolf commented 5 years ago

These are all 2to3 errors, so not technically errors?

@darribas, maybe run 2to3 on these notebooks as part of the buildscript, or we just fix these once & move on.

darribas commented 5 years ago

yeah I could add that script run on the build process. Do you have any pointers on where to find it/how to run it?

More generally, shouldn't notebooks be Python-3 first in all projects in the federation by now? If so, I'm happy to issue a fix upstream on the notebooks.