notebooks icon indicating copy to clipboard operation
notebooks copied to clipboard

SyntaxError: Multiple notebooks

Open thedatalass opened this issue 5 years ago • 2 comments

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)

thedatalass avatar Jul 13 '19 17:07 thedatalass

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.

ljwolf avatar Jul 13 '19 20:07 ljwolf

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.

darribas avatar Jul 15 '19 14:07 darribas