Type error Unhashable type:set

The individual items that you put into a set can’t be mutable, because if they changed, the effective hash would change and thus the ability to check for inclusion would break down. Instead, you need to put immutable objects into a set – e.g. frozensets. If you change the return statement from your enum method to… …then it … Read more

Difference between scikit-learn and sklearn

You might need to reinstall numpy. It doesn’t seem to have installed correctly. sklearn is how you type the scikit-learn name in python. Also, try running the standard tests in scikit-learn and check the output. You will have detailed error information there. Do you have nosetests installed? Try: nosetests -v sklearn. You type this in bash, not in the … Read more

Python Error – int object has no attribute

As time = 3 is declared as an integer, time.time doesn’t have any sense since time is int variable (that isn’t a class but a primitive data type). I suppose that you expected to call time (module) writing time but, since you’re redefining it as an integer, this last definition shadows the time module Change time variable name to something else, like myTime Error messages are usefull, you should read … Read more

Why does using from __future__ import print_function breaks Python2-style print?

First of all, from __future__ import print_function needs to be the first line of code in your script (aside from some exceptions mentioned below). Second of all, as other answers have said, you have to use print as a function now. That’s the whole point of from __future__ import print_function; to bring the print function from Python 3 into Python 2.6+. __future__ statements need … Read more